diff options
Diffstat (limited to 'plugins/CryptoPP/src')
129 files changed, 23080 insertions, 0 deletions
diff --git a/plugins/CryptoPP/src/GPGw/Release/GnuPGw.dll b/plugins/CryptoPP/src/GPGw/Release/GnuPGw.dll Binary files differnew file mode 100644 index 0000000000..7dba65ea45 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/Release/GnuPGw.dll diff --git a/plugins/CryptoPP/src/GPGw/Release/GnuPGw.map b/plugins/CryptoPP/src/GPGw/Release/GnuPGw.map new file mode 100644 index 0000000000..ec55dd6734 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/Release/GnuPGw.map @@ -0,0 +1,259 @@ + GnuPGw
+
+ Timestamp is 49fdd7b0 (Sun May 03 21:43:12 2009)
+
+ Preferred load address is 46100000
+
+ Start Length Name Class
+ 0001:00000000 00001976H .text CODE
+ 0002:00000000 000000e0H .idata$5 DATA
+ 0002:000000e0 00000064H .idata$2 DATA
+ 0002:00000144 00000014H .idata$3 DATA
+ 0002:00000158 000000e0H .idata$4 DATA
+ 0002:00000238 00000314H .idata$6 DATA
+ 0002:00000550 0000017fH .edata DATA
+ 0003:00000000 000006c0H .data DATA
+ 0003:000006c0 00000e60H .bss DATA
+ 0004:00000000 00000088H .rsrc$01 DATA
+ 0004:00000090 000002a0H .rsrc$02 DATA
+
+ Address Publics by Value Rva+Base Lib:Object
+
+ 0001:00000000 _LogMessage 46101000 f commonheaders.obj
+ 0001:0000004b _detectKeys 4610104b f gpg.obj
+ 0001:00000157 _gpgListPublicKeys 46101157 f gpg.obj
+ 0001:00000225 _gpgListSecretKeys 46101225 f gpg.obj
+ 0001:000002f3 _gpgDetectUserID 461012f3 f gpg.obj
+ 0001:000004a3 _gpgEncrypt 461014a3 f gpg.obj
+ 0001:00000611 _gpgDecrypt 46101611 f gpg.obj
+ 0001:00000791 _initKeyUserIDs 46101791 f keys.obj
+ 0001:000007a7 _updateKeyUserIDs 461017a7 f keys.obj
+ 0001:00000880 _releaseKeyUserIDs 46101880 f keys.obj
+ 0001:00000893 _getKeyUserID 46101893 f keys.obj
+ 0001:000008a8 _getKeyUserIDCount 461018a8 f keys.obj
+ 0001:000008b4 __gpg_init 461018b4 f main.obj
+ 0001:000008e4 __gpg_done 461018e4 f main.obj
+ 0001:000008fd __gpg_open_keyrings 461018fd f main.obj
+ 0001:0000096b __gpg_close_keyrings 4610196b f main.obj
+ 0001:0000096f __gpg_get_error 4610196f f main.obj
+ 0001:00000972 __gpg_set_log 46101972 f main.obj
+ 0001:00000999 __gpg_set_tmp 46101999 f main.obj
+ 0001:000009c9 __gpg_get_passphrases 461019c9 f main.obj
+ 0001:00000a71 __gpg_set_passphrases 46101a71 f main.obj
+ 0001:00000b0f __gpg_encrypt 46101b0f f main.obj
+ 0001:00000b8f __gpg_decrypt 46101b8f f main.obj
+ 0001:00000dfb __gpg_size_keyid 46101dfb f main.obj
+ 0001:00000dff __gpg_select_keyid 46101dff f main.obj
+ 0001:00000e4c _GetRegValue 46101e4c f main.obj
+ 0001:00000eb4 _GetEnvValue 46101eb4 f main.obj
+ 0001:00000ef1 _ShowSelectExecDlg 46101ef1 f main.obj
+ 0001:00000fb0 _ShowSelectHomeDlg 46101fb0 f main.obj
+ 0001:0000108c _dllmain@12 4610208c f main.obj
+ 0001:0000109b _PassphraseDialogProcedure@16 4610209b f passdialog.obj
+ 0001:00001109 _initPassphrases 46102109 f passphrases.obj
+ 0001:00001118 _releasePassphrases 46102118 f passphrases.obj
+ 0001:00001161 _addPassphrase 46102161 f passphrases.obj
+ 0001:000011c7 _getPassphrase 461021c7 f passphrases.obj
+ 0001:00001210 _isWindowsNT 46102210 f pipeexec.obj
+ 0001:00001254 _storeOutput 46102254 f pipeexec.obj
+ 0001:000012aa _pxExecute 461022aa f pipeexec.obj
+ 0001:00001498 _replace 46102498 f tools.obj
+ 0001:00001517 _getNextPart 46102517 f tools.obj
+ 0001:0000156c _appendText 4610256c f tools.obj
+ 0001:000015bb _existsFile 461025bb f tools.obj
+ 0001:000015e3 _existsPath 461025e3 f tools.obj
+ 0001:0000160b _writeToFile 4610260b f tools.obj
+ 0001:00001694 _readFromFile 46102694 f tools.obj
+ 0001:0000171c _getTemporaryFileName 4610271c f tools.obj
+ 0001:00001733 _UserIdDialogProcedure@16 46102733 f userdialog.obj
+ 0001:0000186e _RefreshListView 4610286e f userdialog.obj
+ 0001:00001914 _GetOpenFileNameA@4 46102914 f comdlg32:comdlg32.dll
+ 0001:0000191a _strcat 4610291a f msvcrt:MSVCRT.dll
+ 0001:00001920 _strcpy 46102920 f msvcrt:MSVCRT.dll
+ 0001:00001926 _strcmp 46102926 f msvcrt:MSVCRT.dll
+ 0001:0000192c _strlen 4610292c f msvcrt:MSVCRT.dll
+ 0001:00001940 __alloca_probe 46102940 f msvcrt:chkstk.obj
+ 0001:00001940 __chkstk 46102940 f msvcrt:chkstk.obj
+ 0001:00001970 _memset 46102970 f msvcrt:MSVCRT.dll
+ 0002:00000000 __imp__RegCloseKey@4 46103000 advapi32:ADVAPI32.dll
+ 0002:00000004 __imp__RegOpenKeyA@12 46103004 advapi32:ADVAPI32.dll
+ 0002:00000008 __imp__SetSecurityDescriptorDacl@16 46103008 advapi32:ADVAPI32.dll
+ 0002:0000000c __imp__InitializeSecurityDescriptor@8 4610300c advapi32:ADVAPI32.dll
+ 0002:00000010 __imp__RegQueryValueExA@24 46103010 advapi32:ADVAPI32.dll
+ 0002:00000014 \177ADVAPI32_NULL_THUNK_DATA 46103014 advapi32:ADVAPI32.dll
+ 0002:00000018 __imp__PeekNamedPipe@24 46103018 kernel32:KERNEL32.dll
+ 0002:0000001c __imp__WaitForSingleObject@8 4610301c kernel32:KERNEL32.dll
+ 0002:00000020 __imp__WriteFile@20 46103020 kernel32:KERNEL32.dll
+ 0002:00000024 __imp__GetExitCodeProcess@8 46103024 kernel32:KERNEL32.dll
+ 0002:00000028 __imp__CreateProcessA@40 46103028 kernel32:KERNEL32.dll
+ 0002:0000002c __imp__ReadFile@20 4610302c kernel32:KERNEL32.dll
+ 0002:00000030 __imp__CloseHandle@4 46103030 kernel32:KERNEL32.dll
+ 0002:00000034 __imp__CreatePipe@16 46103034 kernel32:KERNEL32.dll
+ 0002:00000038 __imp__GetFileAttributesA@4 46103038 kernel32:KERNEL32.dll
+ 0002:0000003c __imp__GetTempFileNameA@16 4610303c kernel32:KERNEL32.dll
+ 0002:00000040 __imp__GetVersionExA@4 46103040 kernel32:KERNEL32.dll
+ 0002:00000044 __imp__GetEnvironmentVariableA@12 46103044 kernel32:KERNEL32.dll
+ 0002:00000048 __imp__LocalFree@4 46103048 kernel32:KERNEL32.dll
+ 0002:0000004c __imp__LocalAlloc@8 4610304c kernel32:KERNEL32.dll
+ 0002:00000050 __imp__GetStartupInfoA@4 46103050 kernel32:KERNEL32.dll
+ 0002:00000054 __imp__GetTempPathA@8 46103054 kernel32:KERNEL32.dll
+ 0002:00000058 \177KERNEL32_NULL_THUNK_DATA 46103058 kernel32:KERNEL32.dll
+ 0002:0000005c __imp__free 4610305c msvcrt:MSVCRT.dll
+ 0002:00000060 __imp__fseek 46103060 msvcrt:MSVCRT.dll
+ 0002:00000064 __imp__ftell 46103064 msvcrt:MSVCRT.dll
+ 0002:00000068 __imp__fread 46103068 msvcrt:MSVCRT.dll
+ 0002:0000006c __imp__fwrite 4610306c msvcrt:MSVCRT.dll
+ 0002:00000070 __imp__strncat 46103070 msvcrt:MSVCRT.dll
+ 0002:00000074 __imp__memmove 46103074 msvcrt:MSVCRT.dll
+ 0002:00000078 __imp__strchr 46103078 msvcrt:MSVCRT.dll
+ 0002:0000007c __imp__strncpy 4610307c msvcrt:MSVCRT.dll
+ 0002:00000080 __imp__memset 46103080 msvcrt:MSVCRT.dll
+ 0002:00000084 __imp__realloc 46103084 msvcrt:MSVCRT.dll
+ 0002:00000088 __imp__strcat 46103088 msvcrt:MSVCRT.dll
+ 0002:0000008c __imp__strcpy 4610308c msvcrt:MSVCRT.dll
+ 0002:00000090 __imp__fclose 46103090 msvcrt:MSVCRT.dll
+ 0002:00000094 __imp__fputs 46103094 msvcrt:MSVCRT.dll
+ 0002:00000098 __imp__fopen 46103098 msvcrt:MSVCRT.dll
+ 0002:0000009c __imp__strcmp 4610309c msvcrt:MSVCRT.dll
+ 0002:000000a0 __imp__malloc 461030a0 msvcrt:MSVCRT.dll
+ 0002:000000a4 __imp__remove 461030a4 msvcrt:MSVCRT.dll
+ 0002:000000a8 __imp__strstr 461030a8 msvcrt:MSVCRT.dll
+ 0002:000000ac __imp__strncmp 461030ac msvcrt:MSVCRT.dll
+ 0002:000000b0 __imp__strlen 461030b0 msvcrt:MSVCRT.dll
+ 0002:000000b4 \177MSVCRT_NULL_THUNK_DATA 461030b4 msvcrt:MSVCRT.dll
+ 0002:000000b8 __imp__DialogBoxParamA@20 461030b8 user32:USER32.dll
+ 0002:000000bc __imp__SetDlgItemTextA@12 461030bc user32:USER32.dll
+ 0002:000000c0 __imp__EndDialog@8 461030c0 user32:USER32.dll
+ 0002:000000c4 __imp__GetDlgItemTextA@16 461030c4 user32:USER32.dll
+ 0002:000000c8 __imp__EnableWindow@8 461030c8 user32:USER32.dll
+ 0002:000000cc __imp__GetDlgItem@8 461030cc user32:USER32.dll
+ 0002:000000d0 __imp__SendMessageA@16 461030d0 user32:USER32.dll
+ 0002:000000d4 \177USER32_NULL_THUNK_DATA 461030d4 user32:USER32.dll
+ 0002:000000d8 __imp__GetOpenFileNameA@4 461030d8 comdlg32:comdlg32.dll
+ 0002:000000dc \177comdlg32_NULL_THUNK_DATA 461030dc comdlg32:comdlg32.dll
+ 0002:000000e0 __IMPORT_DESCRIPTOR_KERNEL32 461030e0 kernel32:KERNEL32.dll
+ 0002:000000f4 __IMPORT_DESCRIPTOR_USER32 461030f4 user32:USER32.dll
+ 0002:00000108 __IMPORT_DESCRIPTOR_comdlg32 46103108 comdlg32:comdlg32.dll
+ 0002:0000011c __IMPORT_DESCRIPTOR_ADVAPI32 4610311c advapi32:ADVAPI32.dll
+ 0002:00000130 __IMPORT_DESCRIPTOR_MSVCRT 46103130 msvcrt:MSVCRT.dll
+ 0002:00000144 __NULL_IMPORT_DESCRIPTOR 46103144 kernel32:KERNEL32.dll
+ 0003:00000000 _szModuleName 46104000 commonheaders.obj
+ 0003:00000004 _szVersionStr 46104004 commonheaders.obj
+ 0003:00000008 _txtbeginpgpmessage 46104008 commonheaders.obj
+ 0003:0000000c _txtendpgpmessage 4610400c commonheaders.obj
+ 0003:00000010 ??_C@_0BK@JOKF@?9?9?9?9?9END?5PGP?5MESSAGE?9?9?9?9?9?$AA@ 46104010 commonheaders.obj
+ 0003:0000002c ??_C@_0BM@JJIG@?9?9?9?9?9BEGIN?5PGP?5MESSAGE?9?9?9?9?9?$AA@ 4610402c commonheaders.obj
+ 0003:00000048 ??_C@_0BE@LAIP@GnuPG?5DLL?5?$CI1?40?44?41?$CJ?$AA@ 46104048 commonheaders.obj
+ 0003:0000005c ??_C@_05KOGF@GnuPG?$AA@ 4610405c commonheaders.obj
+ 0003:00000064 ??_C@_01FCOA@?5?$AA@ 46104064 commonheaders.obj
+ 0003:00000068 ??_C@_01FNLH@a?$AA@ 46104068 commonheaders.obj
+ 0003:0000006c _txtgpgargslistpublickeys 4610406c gpg.obj
+ 0003:00000070 _txtgpgargslistsecretkeys 46104070 gpg.obj
+ 0003:00000074 _txtgpgargsimportpublickey 46104074 gpg.obj
+ 0003:00000078 _txtgpgargsexportpublickey 46104078 gpg.obj
+ 0003:0000007c _txtgpgargsdetectuserid 4610407c gpg.obj
+ 0003:00000080 _txtgpgargsencrypt 46104080 gpg.obj
+ 0003:00000084 _txtgpgargsdecrypt 46104084 gpg.obj
+ 0003:00000088 _txtpub 46104088 gpg.obj
+ 0003:0000008c _txtsec 4610408c gpg.obj
+ 0003:00000090 _txtcrlf 46104090 gpg.obj
+ 0003:00000094 _txtcolon 46104094 gpg.obj
+ 0003:00000098 _txtquotationmark 46104098 gpg.obj
+ 0003:0000009c _txtgpgcolon 4610409c gpg.obj
+ 0003:000000a0 _txtplainfile 461040a0 gpg.obj
+ 0003:000000a4 _txtcipherfile 461040a4 gpg.obj
+ 0003:000000a8 _txtuserid 461040a8 gpg.obj
+ 0003:000000ac _txtkeyfile 461040ac gpg.obj
+ 0003:000000b0 _txthome 461040b0 gpg.obj
+ 0003:000000b4 _txtidseparator 461040b4 gpg.obj
+ 0003:000000b8 ??_C@_02GIEM@?0?5?$AA@ 461040b8 gpg.obj
+ 0003:000000bc ??_C@_06HJED@?$CFhome?$CF?$AA@ 461040bc gpg.obj
+ 0003:000000c4 ??_C@_09KME@?$CFkeyfile?$CF?$AA@ 461040c4 gpg.obj
+ 0003:000000d0 ??_C@_08OBEK@?$CFuserid?$CF?$AA@ 461040d0 gpg.obj
+ 0003:000000dc ??_C@_0N@OPDF@?$CFcipherfile?$CF?$AA@ 461040dc gpg.obj
+ 0003:000000ec ??_C@_0M@MB@?$CFplainfile?$CF?$AA@ 461040ec gpg.obj
+ 0003:000000f8 ??_C@_04GMI@gpg?3?$AA@ 461040f8 gpg.obj
+ 0003:00000100 ??_C@_01HMO@?$CC?$AA@ 46104100 gpg.obj
+ 0003:00000104 ??_C@_01PKAG@?3?$AA@ 46104104 gpg.obj
+ 0003:00000108 ??_C@_02PIMC@?$AN?6?$AA@ 46104108 gpg.obj
+ 0003:0000010c ??_C@_03CLEA@sec?$AA@ 4610410c gpg.obj
+ 0003:00000110 ??_C@_03BNEF@pub?$AA@ 46104110 gpg.obj
+ 0003:00000114 ??_C@_0FL@MOKP@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9yes?5?9?9passp@ 46104114 gpg.obj
+ 0003:00000170 ??_C@_0IK@JPKD@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9batch?5?9?9yes@ 46104170 gpg.obj
+ 0003:000001fc ??_C@_0DE@MKBK@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9batch?5?9?9dec@ 461041fc gpg.obj
+ 0003:00000230 ??_C@_0FH@ECPM@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9batch?5?9?9yes@ 46104230 gpg.obj
+ 0003:00000288 ??_C@_0CI@MMOA@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9import?5?$CC?$CFke@ 46104288 gpg.obj
+ 0003:000002b0 ??_C@_0DD@DLMD@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9with?9colon?5@ 461042b0 gpg.obj
+ 0003:000002e4 ??_C@_0DD@DFNM@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9with?9colon?5@ 461042e4 gpg.obj
+ 0003:00000318 ??_C@_04BBGP@?2x3a?$AA@ 46104318 gpg.obj
+ 0003:00000320 ??_C@_04DKNC@?$DO?$DO?$DO?5?$AA@ 46104320 gpg.obj
+ 0003:00000328 ??_C@_0BB@JNKM@list?5public?5keys?$AA@ 46104328 gpg.obj
+ 0003:0000033c ??_C@_01BJG@?6?$AA@ 4610433c gpg.obj
+ 0003:00000340 ??_C@_0BB@JDLD@list?5secret?5keys?$AA@ 46104340 gpg.obj
+ 0003:00000354 ??_C@_0P@LHID@detect?5user?5id?$AA@ 46104354 gpg.obj
+ 0003:00000364 ??_C@_07CGOE@encrypt?$AA@ 46104364 gpg.obj
+ 0003:0000036c ??_C@_07BLJA@decrypt?$AA@ 4610436c gpg.obj
+ 0003:00000374 _txtlistpublickeysfailed 46104374 language.obj
+ 0003:00000378 _txtlistsecretkeysfailed 46104378 language.obj
+ 0003:0000037c _txtwarning 4610437c language.obj
+ 0003:00000380 _txterror 46104380 language.obj
+ 0003:00000384 _txtdetectuseridfailed 46104384 language.obj
+ 0003:00000388 _txtunknownuserid 46104388 language.obj
+ 0003:0000038c _txtencryptfailed 4610438c language.obj
+ 0003:00000390 ??_C@_0CP@IGDB@Could?5not?5encrypt?5the?5message?4?5I@ 46104390 language.obj
+ 0003:000003c0 ??_C@_0BA@BMKJ@Unknown?5User?5ID?$AA@ 461043c0 language.obj
+ 0003:000003d0 ??_C@_0GH@PFNF@You?5received?5an?5encrypted?5messag@ 461043d0 language.obj
+ 0003:00000438 ??_C@_0BF@MLAH@GnuPG?5Plugin?5?9?5Error?$AA@ 46104438 language.obj
+ 0003:00000450 ??_C@_0BH@MLOA@GnuPG?5Plugin?5?9?5Warning?$AA@ 46104450 language.obj
+ 0003:00000468 ??_C@_0DE@HEGN@Could?5not?5generate?5a?5list?5of?5the@ 46104468 language.obj
+ 0003:0000049c ??_C@_0DE@LKHI@Could?5not?5generate?5a?5list?5of?5the@ 4610449c language.obj
+ 0003:000004d0 ??_C@_01FFCO@?$AC?$AA@ 461044d0 main.obj
+ 0003:000004d4 ??_C@_01KKJH@?$AB?$AA@ 461044d4 main.obj
+ 0003:000004d8 ??_C@_01FEHD@?$AN?$AA@ 461044d8 main.obj
+ 0003:000004dc ??_C@_0BI@DIOP@Select?5GnuPG?5executable?$AA@ 461044dc main.obj
+ 0003:000004f4 ??_C@_0DI@KIMG@GnuPG?5executable?5?$CIgpg?4exe?$CJ?$AAgpg?4e@ 461044f4 main.obj
+ 0003:0000052c ??_C@_08GIFB@?2gpg?4exe?$AA@ 4610452c main.obj
+ 0003:00000538 ??_C@_0BC@PKCH@Install?5Directory?$AA@ 46104538 main.obj
+ 0003:0000054c ??_C@_0L@KPLK@gpgProgram?$AA@ 4610454c main.obj
+ 0003:00000558 ??_C@_0BD@FFCB@Software?2GNU?2GnuPG?$AA@ 46104558 main.obj
+ 0003:0000056c ??_C@_0BE@JBON@Open?5Public?5Keyring?$AA@ 4610456c main.obj
+ 0003:00000580 ??_C@_0EA@FLAI@Public?5key?5rings?5?$CIpubring?4gpg?$CJ?$AAp@ 46104580 main.obj
+ 0003:000005c0 ??_C@_06OEPH@?2gnupg?$AA@ 461045c0 main.obj
+ 0003:000005c8 ??_C@_07DBHH@APPDATA?$AA@ 461045c8 main.obj
+ 0003:000005d0 ??_C@_07DAJH@HomeDir?$AA@ 461045d0 main.obj
+ 0003:000005d8 ??_C@_09IHAA@GNUPGHOME?$AA@ 461045d8 main.obj
+ 0003:000005e4 ??_C@_08PBHE@output?3?6?$AA@ 461045e4 pipeexec.obj
+ 0003:000005f0 ??_C@_0BG@BFBG@create?5process?5failed?$AA@ 461045f0 pipeexec.obj
+ 0003:00000608 ??_C@_04IGAC@?9?9?9?5?$AA@ 46104608 pipeexec.obj
+ 0003:00000610 ??_C@_0BD@CKEI@create?5pipe?5failed?$AA@ 46104610 pipeexec.obj
+ 0003:00000624 ??_C@_0O@FMDH@commandline?3?6?$AA@ 46104624 pipeexec.obj
+ 0003:00000638 _escsequence 46104638 tools.obj
+ 0003:00000650 _escsequencecount 46104650 tools.obj
+ 0003:00000654 ??_C@_01POCP@?7?$AA@ 46104654 tools.obj
+ 0003:00000658 ??_C@_02NLPO@?2t?$AA@ 46104658 tools.obj
+ 0003:0000065c ??_C@_02CEIM@?2r?$AA@ 4610465c tools.obj
+ 0003:00000660 ??_C@_02HDBI@?2n?$AA@ 46104660 tools.obj
+ 0003:00000664 ??_C@_0L@JBPC@filename?3?6?$AA@ 46104664 tools.obj
+ 0003:00000670 ??_C@_0O@HMCP@write?5to?5file?$AA@ 46104670 tools.obj
+ 0003:00000680 ??_C@_02NGAF@wb?$AA@ 46104680 tools.obj
+ 0003:00000684 ??_C@_03MOIF@gpg?$AA@ 46104684 tools.obj
+ 0003:00000688 ??_C@_0P@EGMO@read?5from?5file?$AA@ 46104688 tools.obj
+ 0003:00000698 ??_C@_02JKAF@rb?$AA@ 46104698 tools.obj
+ 0003:000006ac ??_C@_07GIAA@User?5ID?$AA@ 461046ac userdialog.obj
+ 0003:000006b4 ??_C@_06LGJA@Key?5ID?$AA@ 461046b4 userdialog.obj
+ 0003:000006c0 ??_C@_00A@?$AA@ 461046c0 gpg.obj
+ 0003:000007cc _passphrasecount 461047cc <common>
+ 0003:000007d0 _passphrases 461047d0 <common>
+ 0003:000007e0 _dlgpassphrase 461047e0 <common>
+ 0003:000008e0 _keyuseridcount 461048e0 <common>
+ 0003:000008e8 _keyuserids 461048e8 <common>
+ 0003:00000900 _gpgHomeDirectory 46104900 <common>
+ 0003:00000b00 _gpgExecutable 46104b00 <common>
+ 0003:00000d00 _g_hInst 46104d00 <common>
+ 0003:00000d20 _logfile 46104d20 <common>
+ 0003:00001120 _temporarydirectory 46105120 <common>
+
+ entry point at 0000:00000000
+
+ Static symbols
+
diff --git a/plugins/CryptoPP/src/GPGw/commonheaders.c b/plugins/CryptoPP/src/GPGw/commonheaders.c new file mode 100644 index 0000000000..5404e4ed80 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/commonheaders.c @@ -0,0 +1,42 @@ +#include "commonheaders.h"
+
+LPCSTR szModuleName = MODULENAME;
+LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
+HINSTANCE g_hInst;
+
+char temporarydirectory[fullfilenamesize];
+char logfile[fullfilenamesize];
+/*
+char *txtbeginpgppublickeyblock="-----BEGIN PGP PUBLIC KEY BLOCK-----";
+char *txtendpgppublickeyblock="-----END PGP PUBLIC KEY BLOCK-----";
+*/
+char *txtbeginpgpmessage="-----BEGIN PGP MESSAGE-----";
+char *txtendpgpmessage="-----END PGP MESSAGE-----";
+
+
+void __cdecl ErrorMessage(const char *alevel, const char *atext, const char *ahint)
+{
+ char buffer[errormessagesize];
+
+ strcpy(buffer, atext);
+ strcat(buffer, " ");
+ strcat(buffer, ahint);
+ MessageBox(NULL, buffer, alevel, MB_OK);
+}
+
+
+void __cdecl LogMessage(const char *astart, const char *atext, const char *aend)
+{
+ FILE *log;
+
+ if(logfile[0]=='\0') return;
+
+ log=fopen(logfile, "a");
+ if(log!=NULL)
+ {
+ fputs(astart, log);
+ fputs(atext, log);
+ fputs(aend, log);
+ fclose(log);
+ }
+}
diff --git a/plugins/CryptoPP/src/GPGw/commonheaders.h b/plugins/CryptoPP/src/GPGw/commonheaders.h new file mode 100644 index 0000000000..4ae6e155a7 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/commonheaders.h @@ -0,0 +1,79 @@ +// Windows API
+
+#pragma once
+#define _WIN32_IE 0x0500
+//#define WIN32_LEAN_AND_MEAN
+//#pragma warning(disable: 4078)
+
+#include <windows.h>
+//#include <afxwin.h>
+#include <commdlg.h>
+#include <commctrl.h>
+#include <stdio.h>
+#include "..\version.h"
+
+// gnupg plugin
+#include "resource.h"
+#include "size.h"
+#include "language.h"
+#include "pipeexec.h"
+#include "gpg.h"
+#include "tools.h"
+#include "passphrases.h"
+#include "passdialog.h"
+#include "userdialog.h"
+#include "keys.h"
+
+// debug makro
+#define debugout(mtext) MessageBox(NULL, (mtext), "GnuPG Plugin - Debug", MB_OK)
+
+// passphrase typ
+struct passphrase
+{
+ char keyuserid[keyuseridsize];
+ char passphrase[passphrasesize];
+};
+
+extern struct passphrase *passphrases;
+extern int passphrasecount;
+
+extern char temporarydirectory[fullfilenamesize];
+extern char logfile[fullfilenamesize];
+
+extern char *txtbeginpgppublickeyblock;
+extern char *txtendpgppublickeyblock;
+extern char *txtbeginpgpmessage;
+extern char *txtendpgpmessage;
+
+#ifdef _MSC_VER
+//#pragma comment(linker,"/merge:.rdata=.text")
+#pragma comment(linker,"/entry:dllmain")
+#pragma comment(linker,"/nodefaultlib")
+#pragma comment(linker,"/subsystem:windows")
+#pragma optimize("gsy", on)
+#endif
+
+#define MODULENAME "GnuPG"
+
+extern LPCSTR szModuleName;
+extern LPCSTR szVersionStr;
+extern HINSTANCE g_hInst;
+
+#define DLLEXPORT __declspec(dllexport)
+
+extern DLLEXPORT int __cdecl _gpg_init(void);
+extern DLLEXPORT int __cdecl _gpg_done(void);
+extern DLLEXPORT int __cdecl _gpg_open_keyrings(LPSTR,LPSTR);
+extern DLLEXPORT int __cdecl _gpg_close_keyrings(void);
+extern DLLEXPORT void __cdecl _gpg_set_log(LPCSTR);
+extern DLLEXPORT void __cdecl _gpg_set_tmp(LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_get_error(void);
+extern DLLEXPORT int __cdecl _gpg_size_keyid(void);
+extern DLLEXPORT int __cdecl _gpg_select_keyid(HWND,LPSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_encrypt(LPCSTR,LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_decrypt(LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_get_passphrases();
+extern DLLEXPORT void __cdecl _gpg_set_passphrases(LPCSTR);
+
+void __cdecl ErrorMessage(const char *alevel, const char *atext, const char *ahint);
+void __cdecl LogMessage(const char *astart, const char *atext, const char *aend);
diff --git a/plugins/CryptoPP/src/GPGw/gpg.c b/plugins/CryptoPP/src/GPGw/gpg.c new file mode 100644 index 0000000000..8ec3a57b11 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/gpg.c @@ -0,0 +1,366 @@ +#include "commonheaders.h"
+#include <stdio.h>
+
+char *txtgpgargslistpublickeys=
+ "--homedir \"%home%\""
+ " --with-colon" // felder durch : voneinander abgetrennt
+ " --list-public-keys"; // oeffentliche schluessel auflisten
+char *txtgpgargslistsecretkeys=
+ "--homedir \"%home%\""
+ " --with-colon"
+ " --list-secret-keys"; // geheime schluessel auflisten
+char *txtgpgargsimportpublickey=
+ "--homedir \"%home%\""
+ " --import \"%keyfile%\""; // schluessel importieren
+char *txtgpgargsexportpublickey=
+ "--homedir \"%home%\""
+ " --batch"
+ " --yes" // abfragen mit ja beantworten
+ " --armor" // ausgabe als text
+ " --comment \"\"" // kommentar unterdruecken ("Comment: For info see http://www.gnupg.org")
+ " --no-version" // ausgabe der version unterdruecken ("Version: GnuPG v1.0.6 (MingW32)")
+ " --export \"%userid%\""; // export des schluessels %userid%
+char *txtgpgargsdetectuserid=
+ "--homedir \"%home%\""
+ " --batch" // interaktion verhindern (daraus folgt fehler)
+ " --decrypt \"%cipherfile%\""; // datei %cipherfile% entschluesseln
+char *txtgpgargsencrypt=
+ "--homedir \"%home%\""
+ " --batch"
+ " --yes" // abfragen mit ja beantworten
+ " --armor" // textausgabe
+ " --comment \"\"" // kein kommentar hinzufuegen
+ " --no-version" // keine versions informationen hinzufuegen
+ " --recipient \"%userid%\"" // %userid% des empfaengers
+ " --output \"%cipherfile%\"" // ausgabe in datei %cipherfile%
+ " --encrypt \"%plainfile%\""; // eingabe kommt aus %plainfile%
+char *txtgpgargsdecrypt=
+ "--homedir \"%home%\""
+ " --yes" // abfragen mit ja beantworten
+ " --passphrase-fd 0" // passphrase von stdin
+ " --output \"%plainfile%\"" // ausgabe in datei %plainfile%
+ " --decrypt \"%cipherfile%\""; // eingabe kommt aus %cipherfile%
+
+// oeffentliche zeichenketten
+char gpgExecutable[argumentsize];
+char gpgHomeDirectory[argumentsize];
+
+
+// zeichenketten fuer den internen gebrauch
+char *txtpub="pub";
+char *txtsec="sec";
+char *txtcrlf="\r\n";
+char *txtcolon=":";
+char *txtquotationmark="\"";
+char *txtgpgcolon="gpg:";
+char *txtplainfile="%plainfile%";
+char *txtcipherfile="%cipherfile%";
+char *txtuserid="%userid%";
+char *txtkeyfile="%keyfile%";
+char *txthome="%home%";
+char *txtidseparator=", ";
+
+
+void assembleCommandLine(char *aresult, const char *aexecutable, const char *aargs)
+{
+ strcpy(aresult, aexecutable);
+ strcat(aresult, " ");
+ strcat(aresult, aargs);
+}
+
+
+void detectKeys(char *aresult, char *aoutput, const char *alabel)
+{
+ char line[linesize];
+ char part[linesize];
+ char *linepos;
+ char *partpos;
+ long i;
+
+ strcpy(aresult, "");
+ linepos=aoutput;
+
+ do
+ {
+ linepos=getNextPart(line, linepos, txtcrlf);
+ if(linepos==NULL) break;
+
+ partpos=line;
+ partpos=getNextPart(part, partpos, txtcolon);
+
+ if(strcmp(part, alabel)==0)
+ for(i=1; i<=10; i++)
+ {
+ partpos=getNextPart(part, partpos, txtcolon);
+
+ switch(i)
+ {
+ case 4:
+ strcat(aresult, part);
+ strcat(aresult, txtidseparator);
+ break;
+ case 9:
+ strcat(aresult, part);
+ strcat(aresult, txtcrlf);
+ break;
+ }
+ }
+ }
+ while(linepos!=NULL);
+
+ replace(aresult, "\\x3a", ":");
+}
+
+
+gpgResult gpgListPublicKeys(char *aresult)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "list public keys", "\n");
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargslistpublickeys);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+
+ if ((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ detectKeys(aresult, output, txtpub);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgListSecretKeys(char *aresult)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "list secret keys", "\n");
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargslistsecretkeys);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+
+ if ((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ detectKeys(aresult, output, txtsec);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgImportPublicKey(const char *akey)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char filename[fullfilenamesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "import public key", "\n");
+ if (! writeToFile(filename, akey)) return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsimportpublickey);
+ replace(commandline, txtkeyfile, filename);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+ remove(filename);
+ free(output);
+
+ if ((pxresult!=pxSuccess)||(exitcode!=0))
+ return gpgExecuteFailed;
+
+ return gpgSuccess;
+}
+
+
+gpgResult gpgExportPublicKey(char *aresult, const char *auserid)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "export public key", "\n");
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsexportpublickey);
+ replace(commandline, txtuserid, auserid);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+
+ if ((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ strcpy(aresult, "");
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ strcpy(aresult, output);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgDetectUserID(char *aresult, const char *aciphertext)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char filename[fullfilenamesize];
+ char line[linesize];
+ char part[linesize];
+ char *linepos;
+ char *partpos;
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "detect user id", "\n");
+ strcpy(aresult, "");
+
+ if (! writeToFile(filename, aciphertext))
+ return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsdetectuserid);
+ replace(commandline, txtcipherfile, filename);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+ remove(filename);
+
+ if ((pxresult!=pxSuccess)&&(pxresult!=pxSuccessExitCodeInvalid))
+ {
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ linepos=output;
+
+ do
+ {
+ linepos=getNextPart(line, linepos, txtcrlf);
+ if(strncmp(line, txtgpgcolon, strlen(txtgpgcolon))!=0 && strstr(line, txtgpgcolon)==0)
+ {
+ partpos=line;
+ partpos=getNextPart(part, partpos, txtquotationmark);
+ getNextPart(part, partpos, txtquotationmark);
+ linepos=NULL;
+ }
+ }
+ while(linepos!=NULL);
+ strcpy(aresult, part);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgEncrypt(char *aresult, const char *auserid, const char *aplaintext)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char plainfile[fullfilenamesize];
+ char cipherfile[fullfilenamesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "encrypt", "\n");
+ strcpy(aresult, "");
+
+ if (! writeToFile(plainfile, aplaintext))
+ return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ getTemporaryFileName(cipherfile);
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsencrypt);
+ replace(commandline, txtcipherfile, cipherfile);
+ replace(commandline, txtplainfile, plainfile);
+ replace(commandline, txtuserid, auserid);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+ remove(plainfile);
+ free(output);
+
+ if ((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ remove(cipherfile);
+ return gpgExecuteFailed;
+ }
+
+ if (! readFromFile(aresult, cipherfile))
+ {
+ remove(cipherfile);
+ return gpgReadFromFileFailed;
+ }
+
+ remove(cipherfile);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgDecrypt(char *aresult, const char *aciphertext, const char *apassphrase)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char plainfile[fullfilenamesize];
+ char cipherfile[fullfilenamesize];
+ char passphrase[linesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "decrypt", "\n");
+ strcpy(aresult, "");
+
+ if (! writeToFile(cipherfile, aciphertext))
+ return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ getTemporaryFileName(plainfile);
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsdecrypt);
+ replace(commandline, txtcipherfile, cipherfile);
+ replace(commandline, txtplainfile, plainfile);
+ replace(commandline, txthome, gpgHomeDirectory);
+ strcpy(passphrase, apassphrase);
+ strcat(passphrase, txtcrlf);
+ pxresult=pxExecute(commandline, passphrase, &output, &exitcode);
+ remove(cipherfile);
+ free(output);
+
+ if ((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ remove(plainfile);
+ return gpgExecuteFailed;
+ }
+
+ if (! readFromFile(aresult, plainfile))
+ {
+ remove(plainfile);
+ return gpgReadFromFileFailed;
+ }
+
+ remove(plainfile);
+ return gpgSuccess;
+}
+
diff --git a/plugins/CryptoPP/src/GPGw/gpg.h b/plugins/CryptoPP/src/GPGw/gpg.h new file mode 100644 index 0000000000..5a06071e4a --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/gpg.h @@ -0,0 +1,40 @@ +#ifndef __GPG_H__
+#define __GPG_H__
+
+typedef enum
+{
+ gpgSuccess,
+ gpgUnknownError,
+ gpgWriteToFileFailed,
+ gpgReadFromFileFailed,
+ gpgExecuteFailed
+}
+gpgResult;
+
+// konstanten fuer die initialisierung der parameter
+extern char *txtgpgargslistpublickeys;
+extern char *txtgpgargslistsecretkeys;
+extern char *txtgpgargsimportpublickey;
+extern char *txtgpgargsexportpublickey;
+extern char *txtgpgargsdetectuserid;
+extern char *txtgpgargsencrypt;
+extern char *txtgpgargsdecrypt;
+
+// sonstige konstanten
+extern char *txtcrlf;
+extern char *txtidseparator;
+
+// zeichenketten
+extern char gpgExecutable[];
+extern char gpgHomeDirectory[];
+
+// funktionsprototypen
+gpgResult gpgListPublicKeys(char *aresult);
+gpgResult gpgListSecretKeys(char *aresult);
+gpgResult gpgImportPublicKey(const char *akey);
+gpgResult gpgExportPublicKey(char *aresult, const char *auserid);
+gpgResult gpgDetectUserID(char *aresult, const char *aciphertext);
+gpgResult gpgEncrypt(char *aresult, const char *auserid, const char *aplaintext);
+gpgResult gpgDecrypt(char *aresult, const char *aciphertext, const char *apassphrase);
+
+#endif // __GPG_H__
diff --git a/plugins/CryptoPP/src/GPGw/keys.c b/plugins/CryptoPP/src/GPGw/keys.c new file mode 100644 index 0000000000..4cfbe4f71d --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/keys.c @@ -0,0 +1,67 @@ +#include "commonheaders.h"
+
+typedef char tkeyuserid[keyuseridsize];
+
+tkeyuserid *keyuserids[2];
+int keyuseridcount[2];
+
+
+void initKeyUserIDs(const int atype)
+{
+ keyuseridcount[atype]=0;
+ keyuserids[atype]=NULL;
+}
+
+
+void updateKeyUserIDs(const int atype)
+{
+ char *pos;
+ gpgResult gpgresult;
+ char buffer[largebuffersize];
+ char keyuserid[keyuseridsize];
+
+ releaseKeyUserIDs(atype);
+ initKeyUserIDs(atype);
+
+ ZeroMemory(buffer, sizeof(buffer));
+ if(atype==publickeyuserid) gpgresult=gpgListPublicKeys(buffer);
+ else gpgresult=gpgListSecretKeys(buffer);
+
+ if(gpgresult!=gpgSuccess)
+ {
+// if(atype==publickeyuserid) ErrorMessage(txterror, txtlistpublickeysfailed, txtverifyoptions);
+// else ErrorMessage(txterror, txtlistsecretkeysfailed, txtverifyoptions);
+ return;
+ }
+
+ for(pos=buffer; pos!=NULL; )
+ {
+ pos=getNextPart(keyuserid, pos, txtcrlf);
+
+ if(pos!=NULL)
+ {
+ keyuseridcount[atype]++;
+ keyuserids[atype]=realloc(keyuserids[atype], sizeof(tkeyuserid)*keyuseridcount[atype]);
+ strcpy(keyuserids[atype][keyuseridcount[atype]-1], keyuserid);
+ }
+ }
+}
+
+
+void releaseKeyUserIDs(const int atype)
+{
+ free(keyuserids[atype]);
+}
+
+
+char *getKeyUserID(const int atype, const int aindex)
+{
+ return keyuserids[atype][aindex];
+}
+
+
+int getKeyUserIDCount(const int atype)
+{
+ return keyuseridcount[atype];
+}
+
diff --git a/plugins/CryptoPP/src/GPGw/keys.h b/plugins/CryptoPP/src/GPGw/keys.h new file mode 100644 index 0000000000..394c6c05b8 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/keys.h @@ -0,0 +1,13 @@ +#ifndef __KEYS_H__
+#define __KEYS_H__
+
+#define publickeyuserid 0
+#define secretkeyuserid 1
+
+void initKeyUserIDs(const int atype);
+void updateKeyUserIDs(const int atype);
+void releaseKeyUserIDs(const int atype);
+char *getKeyUserID(const int atype, const int aindex);
+int getKeyUserIDCount(const int atype);
+
+#endif // __KEYS_H__
diff --git a/plugins/CryptoPP/src/GPGw/language.c b/plugins/CryptoPP/src/GPGw/language.c new file mode 100644 index 0000000000..4997711629 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/language.c @@ -0,0 +1,27 @@ +#include "commonheaders.h"
+
+//char *txtverifyoptions="Please verify your settings in M->Options->Plugins->GnuPG and GnuPG Advanced."; /*lang*/
+//char *txtinvalidexecutable="The GnuPG Plugin requires the GnuPG executable \"gpg.exe\"."; /*lang*/
+//char *txtinvaliduserid="Could not obtain the GnuPG user id."; /*lang*/
+//char *txtexportpublickeyfailed="The export of your public key failed."; /*lang*/
+//char *txtimportpublickeyfailed="The import of the key failed."; /*lang*/
+char *txtlistpublickeysfailed="Could not generate a list of the public GnuPG keys."; /*lang*/
+char *txtlistsecretkeysfailed="Could not generate a list of the secret GnuPG keys."; /*lang*/
+//char *txtplugins="Plugins"; /*lang*/
+//char *txtgnupgplugin="GnuPG Plugin"; /*lang*/
+//char *txtexecutablefiles="Executable Files"; /*lang*/
+//char *txtselectexecutable="Select GnuPG Executable"; /*lang*/
+char *txtwarning="GnuPG Plugin - Warning"; /*lang*/
+char *txterror="GnuPG Plugin - Error"; /*lang*/
+//char *txtnone="<none>"; /*lang*/
+//char *txtuseencryption="Use GnuPG Encryption"; /*lang*/
+//char *txtsendpublickey="Send GnuPG Key"; /*lang*/
+//char *txtpublickeyreceived="You received a public key."; /*lang*/
+//char *txtpublickeyreceivedstored="You received a public key. It was added to your keyring."; /*lang*/
+char *txtdetectuseridfailed="You received an encrypted message. Could not detect the user id of the public key, used to encrypt it."; /*lang*/
+char *txtunknownuserid="Unknown User ID"; /*lang*/
+char *txtencryptfailed="Could not encrypt the message. It wasn't sent."; /*lang*/
+//char *txtoptions="GnuPG"; /*lang*/
+//char *txtexpertoptions="GnuPG Advanced"; /*lang*/
+
+
diff --git a/plugins/CryptoPP/src/GPGw/language.h b/plugins/CryptoPP/src/GPGw/language.h new file mode 100644 index 0000000000..6c3548b4c3 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/language.h @@ -0,0 +1,29 @@ +#ifndef __TEXT_H__
+#define __TEXT_H__
+
+// textkonstanten, die uebersetzt werden muessen
+extern char *txtverifyoptions;
+extern char *txtinvalidexecutable;
+extern char *txtinvaliduserid;
+extern char *txtexportpublickeyfailed;
+extern char *txtimportpublickeyfailed;
+extern char *txtlistpublickeysfailed;
+extern char *txtlistsecretkeysfailed;
+extern char *txtplugins;
+extern char *txtgnupgplugin;
+extern char *txtexecutablefiles;
+extern char *txtselectexecutable;
+extern char *txtwarning;
+extern char *txterror;
+extern char *txtnone;
+extern char *txtuseencryption;
+extern char *txtsendpublickey;
+extern char *txtpublickeyreceived;
+extern char *txtpublickeyreceivedstored;
+extern char *txtdetectuseridfailed;
+extern char *txtunknownuserid;
+extern char *txtencryptfailed;
+extern char *txtoptions;
+extern char *txtexpertoptions;
+
+#endif // __TEXT_H__
diff --git a/plugins/CryptoPP/src/GPGw/main.c b/plugins/CryptoPP/src/GPGw/main.c new file mode 100644 index 0000000000..fc23b24262 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/main.c @@ -0,0 +1,369 @@ +#include "commonheaders.h"
+
+
+BOOL ShowSelectExecDlg(LPSTR);
+BOOL ShowSelectHomeDlg(LPSTR);
+
+
+int __cdecl _gpg_init()
+{
+ GetTempPath(sizeof(temporarydirectory),temporarydirectory);
+ logfile[0]='\0';
+ initPassphrases();
+ initKeyUserIDs(publickeyuserid);
+ initKeyUserIDs(secretkeyuserid);
+ return 1;
+}
+
+
+int __cdecl _gpg_done()
+{
+ releaseKeyUserIDs(secretkeyuserid);
+ releaseKeyUserIDs(publickeyuserid);
+ releasePassphrases();
+ return 1;
+}
+
+
+int __cdecl _gpg_open_keyrings(LPSTR ExecPath, LPSTR HomePath)
+{
+ if ( !ExecPath || (!*ExecPath && !ShowSelectExecDlg(ExecPath)) ) {
+ return 0;
+ }
+ if ( !HomePath || (!*HomePath && !ShowSelectHomeDlg(HomePath)) ) {
+ return 0;
+ }
+ if ( !existsFile(ExecPath) ) {
+// ErrorMessage(txtwarning, txtinvalidexecutable, txtverifyoptions);
+ return 0;
+ }
+ strcpy(gpgExecutable, ExecPath);
+ strcpy(gpgHomeDirectory, HomePath);
+ updateKeyUserIDs(publickeyuserid);
+ updateKeyUserIDs(secretkeyuserid);
+ return 1;
+}
+
+
+int __cdecl _gpg_close_keyrings()
+{
+ return 1;
+}
+
+
+LPSTR __cdecl _gpg_get_error()
+{
+ return 0;
+}
+
+
+void __cdecl _gpg_set_log(LPCSTR LogPath)
+{
+ if(LogPath) strncpy(logfile,LogPath,sizeof(logfile));
+ else logfile[0]='\0';
+}
+
+
+void __cdecl _gpg_set_tmp(LPCSTR TmpPath)
+{
+ if(TmpPath) strncpy(temporarydirectory,TmpPath,sizeof(temporarydirectory));
+ else GetTempPath(sizeof(temporarydirectory),temporarydirectory);
+}
+
+
+LPSTR __cdecl _gpg_get_passphrases()
+{
+ size_t i; char *b, x;
+
+ b = (char *) LocalAlloc(LPTR,(keyuseridsize+passphrasesize)*passphrasecount+1); *b = '\0';
+
+ for(i=0; i<(size_t)passphrasecount; i++) {
+ strcat(b,passphrases[i].keyuserid); strcat(b,"\x01");
+ strcat(b,passphrases[i].passphrase); strcat(b,"\x02");
+ }
+
+ // encrypt
+ for(i=0; i<strlen(b); i++)
+ if ( b[i]>2 ) {
+ x = b[i] ^ ( (i&0x7f) ^ 13);
+ if ( x>2 ) b[i]=x;
+ }
+
+ return b;
+}
+
+
+void __cdecl _gpg_set_passphrases(LPCSTR buffer)
+{
+ size_t i, l = strlen(buffer); char *t, *p, *b, x;
+
+ if ( !l ) return;
+
+ b = (char *) LocalAlloc(LPTR,l+1);
+ strcpy(b, buffer);
+
+ // decrypt
+ for(i=0; i<strlen(b); i++)
+ if ( b[i]>2 ) {
+ x = b[i] ^ ( (i&0x7f) ^ 13);
+ if ( x>2 ) b[i]=x;
+ }
+
+ while(*b) {
+ t = strchr(b, '\x02');
+ if(t) {
+ *t = '\0';
+ p = strchr(b, '\x01');
+ *p = '\0';
+ addPassphrase(b, p+1);
+ t++;
+ }
+ b = t;
+ }
+ LocalFree(b);
+}
+
+
+LPSTR __cdecl _gpg_encrypt(LPCSTR message, LPCSTR keyid)
+{
+ char buffer[ciphertextsize];
+ char *encmessage = 0;
+ int encmessagelen;
+ gpgResult gpgresult;
+
+ if(strlen(keyid))
+ {
+ ZeroMemory(buffer, sizeof(buffer));
+ gpgresult=gpgEncrypt(buffer, keyid, message);
+
+ if(gpgresult!=gpgSuccess)
+ {
+// ErrorMessage(txterror, txtencryptfailed, txtverifyoptions);
+ return 0;
+ }
+ encmessagelen = strlen(buffer)+1;
+ encmessage = (char *) LocalAlloc(LPTR,encmessagelen);
+ MoveMemory(encmessage, buffer, encmessagelen);
+ }
+
+ return encmessage;
+}
+
+
+LPSTR __cdecl _gpg_decrypt(LPCSTR message)
+{
+ char buffer[ciphertextsize];
+ char plaintext[plaintextsize];
+ char keyuserid[keyuseridsize];
+ char *begin, *end;
+ int dlgresult;
+ BOOL useridvalid;
+ char *storedpassphrase;
+ char passphrase[passphrasesize];
+ char *decmessage = 0;
+ int decmessagelen;
+ gpgResult gpgresult;
+
+ begin=strstr(message, txtbeginpgpmessage);
+ end=strstr(message, txtendpgpmessage);
+
+ if ((begin!=NULL)&&(end!=NULL))
+ {
+ strcpy(buffer, "");
+ strncat(buffer, begin, end-begin+strlen(txtendpgpmessage));
+ replace(buffer, "\r", "");
+ replace(buffer, "\n", txtcrlf);
+
+ ZeroMemory(keyuserid, sizeof(keyuserid));
+ gpgresult=gpgDetectUserID(keyuserid, buffer);
+ storedpassphrase=NULL;
+
+ if(gpgresult!=gpgSuccess)
+ {
+// ErrorMessage(txtwarning, txtdetectuseridfailed, txtverifyoptions);
+ strcpy(keyuserid, txtunknownuserid);
+ useridvalid=FALSE;
+ }
+ else
+ {
+ storedpassphrase=getPassphrase(keyuserid);
+ useridvalid=TRUE;
+ }
+
+ if(storedpassphrase!=NULL)
+ {
+ strcpy(passphrase, storedpassphrase);
+ ZeroMemory(plaintext, sizeof(plaintext));
+ gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
+ }
+ else gpgresult=gpgUnknownError;
+
+ dlgresult=IDOK;
+ while((gpgresult!=gpgSuccess)&&(dlgresult!=IDCANCEL))
+ {
+ dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, PassphraseDialogProcedure, (LPARAM)keyuserid);
+
+ if(dlgresult==IDOK)
+ {
+ strcpy(passphrase, dlgpassphrase);
+ ZeroMemory(dlgpassphrase, passphrasesize);
+ strcat(passphrase, txtcrlf);
+ ZeroMemory(plaintext, sizeof(plaintext));
+ gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
+ }
+ }
+
+ if(gpgresult==gpgSuccess)
+ {
+ strcpy(buffer, plaintext);
+ }
+
+ if ( gpgresult==gpgSuccess && useridvalid==TRUE)
+ addPassphrase(keyuserid, passphrase);
+
+ ZeroMemory(passphrase, sizeof(passphrase));
+
+ decmessagelen = strlen(buffer)+1;
+ decmessage = (char *) LocalAlloc(LPTR,decmessagelen);
+ MoveMemory(decmessage, buffer, decmessagelen);
+ }
+
+ return decmessage;
+}
+
+
+int __cdecl _gpg_size_keyid()
+{
+ return keyidsize;
+}
+
+
+int __cdecl _gpg_select_keyid(HWND hdlg, LPSTR keyid)
+{
+ int dlgresult;
+
+ ZeroMemory(keyid, keyidsize);
+ dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTKEY), hdlg, UserIdDialogProcedure, (LPARAM)keyid);
+
+ if(dlgresult!=IDOK)
+ ZeroMemory(keyid, keyidsize);
+
+ return (dlgresult==IDOK);
+}
+
+
+void noBackslash(LPSTR path) {
+ LPSTR ptr;
+ ptr = path + strlen(path) - 1;
+ if ( *ptr=='\\' ) *ptr = '\0';
+}
+
+
+static char buf[MAX_PATH];
+
+
+LPSTR GetRegValue(HKEY hKey , LPCSTR szPath, LPCSTR szName){
+ DWORD len=MAX_PATH,type;
+ LPSTR ret=0;
+
+ RegOpenKey(hKey,szPath,&hKey);
+ if ( RegQueryValueEx(hKey,szName,NULL,&type,(LPBYTE)&buf,&len)==ERROR_SUCCESS ) {
+ noBackslash((LPSTR)&buf);
+ ret = (LPSTR)&buf;
+ }
+ RegCloseKey(hKey);
+
+ return ret;
+}
+
+
+LPSTR GetEnvValue(LPCSTR szName){
+ LPSTR ret=0;
+
+ if ( GetEnvironmentVariable(szName, buf, MAX_PATH) > 0 ) {
+ noBackslash((LPSTR)&buf);
+ ret = (LPSTR)&buf;
+ }
+
+ return ret;
+}
+
+
+BOOL ShowSelectExecDlg(LPSTR path)
+{
+ OPENFILENAME ofn;
+ ZeroMemory(&ofn,sizeof(ofn));
+
+ ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","gpgProgram");
+ if ( ofn.lpstrFile && existsFile(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetRegValue(HKEY_LOCAL_MACHINE,"Software\\GNU\\GnuPG","Install Directory");
+ if ( ofn.lpstrFile ) {
+ strcat(ofn.lpstrFile,"\\gpg.exe");
+ if ( existsFile(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ }
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
+
+ ofn.lpstrFile = path;
+ ofn.lpstrFilter = "GnuPG executable (gpg.exe)\0gpg.exe\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Select GnuPG executable";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ return TRUE;
+}
+
+
+BOOL ShowSelectHomeDlg(LPSTR path)
+{
+ int i;
+ OPENFILENAME ofn;
+
+ ofn.lpstrFile = GetEnvValue("GNUPGHOME");
+ if ( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","HomeDir");
+ if ( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetEnvValue("APPDATA");
+ if ( ofn.lpstrFile ) {
+ strcat(ofn.lpstrFile,"\\gnupg");
+ if ( existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ }
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
+
+ ofn.lpstrFile = path;
+ ofn.lpstrFilter = "Public key rings (pubring.gpg)\0pubring.gpg\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Open Public Keyring";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ for(i=strlen(path);i && path[i]!='\\';i--);
+ path[i] = 0;
+
+ return TRUE;
+}
+
+
+// dllmain
+BOOL WINAPI dllmain(HINSTANCE hInst, DWORD dwReason, LPVOID lpVoid) {
+ g_hInst = hInst;
+ return TRUE;
+}
+
diff --git a/plugins/CryptoPP/src/GPGw/passdialog.c b/plugins/CryptoPP/src/GPGw/passdialog.c new file mode 100644 index 0000000000..cbba1139ab --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/passdialog.c @@ -0,0 +1,29 @@ +#include "commonheaders.h"
+
+char dlgpassphrase[passphrasesize];
+
+
+BOOL CALLBACK PassphraseDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ SetDlgItemText(hdlg, IDC_USERID, (char *)lparam);
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wparam))
+ {
+ case IDOK:
+ ZeroMemory(dlgpassphrase, sizeof(dlgpassphrase));
+ GetDlgItemText(hdlg, IDC_PASSPHRASE, dlgpassphrase, sizeof(dlgpassphrase));
+ case IDCANCEL:
+ EndDialog(hdlg, wparam);
+ return TRUE;
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
diff --git a/plugins/CryptoPP/src/GPGw/passdialog.h b/plugins/CryptoPP/src/GPGw/passdialog.h new file mode 100644 index 0000000000..b59f421b3c --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/passdialog.h @@ -0,0 +1,8 @@ +#ifndef __PASSDIALOG_H__
+#define __PASSDIALOG_H__
+
+extern char dlgpassphrase[];
+
+BOOL CALLBACK PassphraseDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam);
+
+#endif // __PASSDIALOG_H__
diff --git a/plugins/CryptoPP/src/GPGw/passphrases.c b/plugins/CryptoPP/src/GPGw/passphrases.c new file mode 100644 index 0000000000..5e93936ffc --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/passphrases.c @@ -0,0 +1,50 @@ +#include "commonheaders.h"
+
+// globale variablen
+struct passphrase *passphrases;
+int passphrasecount;
+
+
+void initPassphrases(void)
+{
+ passphrasecount=0;
+ passphrases=NULL;
+}
+
+
+void releasePassphrases(void)
+{
+ int i;
+
+ for(i=0; i<passphrasecount; i++)
+ ZeroMemory(passphrases[i].passphrase, sizeof(passphrases[i].passphrase));
+
+ free(passphrases);
+}
+
+
+void addPassphrase(const char *akeyuserid, const char *apassphrase)
+{
+ passphrasecount++;
+ passphrases=realloc(passphrases, sizeof(struct passphrase)*passphrasecount);
+
+ strcpy(passphrases[passphrasecount-1].keyuserid, akeyuserid);
+ strcpy(passphrases[passphrasecount-1].passphrase, apassphrase);
+}
+
+
+char *getPassphrase(const char *akeyuserid)
+{
+ int i;
+ char *result;
+
+ result=NULL;
+ for(i=0; i<passphrasecount; i++)
+ {
+ if(strcmp(passphrases[i].keyuserid, akeyuserid)==0)
+ result=passphrases[i].passphrase;
+ }
+
+ return result;
+}
+
diff --git a/plugins/CryptoPP/src/GPGw/passphrases.h b/plugins/CryptoPP/src/GPGw/passphrases.h new file mode 100644 index 0000000000..9a2c25dadd --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/passphrases.h @@ -0,0 +1,10 @@ +#ifndef __PASSPHRASES_H__
+#define __PASSPHRASES_H__
+
+// funktions prototypen
+void initPassphrases(void);
+void releasePassphrases(void);
+void addPassphrase(const char *akeyuserid, const char *apassphrase);
+char *getPassphrase(const char *akeyuserid);
+
+#endif // __PASSPHRASES_H__
diff --git a/plugins/CryptoPP/src/GPGw/pipeexec.c b/plugins/CryptoPP/src/GPGw/pipeexec.c new file mode 100644 index 0000000000..ea54f85d1a --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/pipeexec.c @@ -0,0 +1,134 @@ +#include "commonheaders.h"
+
+
+BOOL isWindowsNT(void)
+{
+ BOOL result;
+ OSVERSIONINFO ovi;
+
+ ZeroMemory(&ovi, sizeof(ovi));
+ ovi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
+ GetVersionEx(&ovi);
+
+ if(ovi.dwPlatformId==VER_PLATFORM_WIN32_NT) result=TRUE;
+ else result=FALSE;
+
+ return result;
+}
+
+
+void storeOutput(HANDLE ahandle, char **aoutput)
+{
+ DWORD success;
+ char readbuffer[10];
+ DWORD transfered;
+ DWORD available;
+
+ do
+ {
+ PeekNamedPipe(ahandle, NULL, 0, NULL, &available, NULL);
+
+ if(available==0) continue;
+
+ success=ReadFile(ahandle, readbuffer, sizeof(readbuffer), &transfered, NULL);
+
+ if ((success)&&(transfered!=0))
+ appendText(aoutput, readbuffer, transfered);
+ }
+ while(available>0);
+}
+
+
+pxResult pxExecute(char *acommandline, char *ainput, char **aoutput, LPDWORD aexitcode)
+{
+ BOOL success;
+ STARTUPINFO startupinfo;
+ SECURITY_ATTRIBUTES securityattributes;
+ SECURITY_DESCRIPTOR securitydescriptor;
+ PROCESS_INFORMATION processinformation;
+ HANDLE newstdin, newstdout, readstdout, writestdin;
+ char *inputpos;
+ DWORD transfered;
+ int size;
+
+ LogMessage("commandline:\n", acommandline, "\n");
+
+ ZeroMemory(&securityattributes, sizeof(securityattributes));
+ securityattributes.nLength=sizeof(SECURITY_ATTRIBUTES);
+ securityattributes.bInheritHandle=TRUE;
+
+ if(isWindowsNT())
+ {
+ InitializeSecurityDescriptor(&securitydescriptor, SECURITY_DESCRIPTOR_REVISION);
+ SetSecurityDescriptorDacl(&securitydescriptor, TRUE, NULL, FALSE);
+ securityattributes.lpSecurityDescriptor=&securitydescriptor;
+ }
+ else securityattributes.lpSecurityDescriptor=NULL;
+
+ success=CreatePipe(&newstdin, &writestdin ,&securityattributes ,0);
+ if (! success)
+ {
+ LogMessage("--- ", "create pipe failed", "\n");
+ return pxCreatePipeFailed;
+ }
+
+ success=CreatePipe(&readstdout, &newstdout, &securityattributes, 0);
+ if (! success)
+ {
+ LogMessage("--- ", "create pipe failed", "\n");
+ CloseHandle(newstdin);
+ CloseHandle(writestdin);
+ return pxCreatePipeFailed;
+ }
+
+ GetStartupInfo(&startupinfo);
+ startupinfo.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
+ startupinfo.wShowWindow=SW_HIDE;
+ startupinfo.hStdOutput=newstdout;
+ startupinfo.hStdError=newstdout;
+ startupinfo.hStdInput=newstdin;
+
+ success=CreateProcess(NULL, acommandline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &startupinfo, &processinformation);
+
+ if (! success)
+ {
+ LogMessage("--- ", "create process failed", "\n");
+ CloseHandle(newstdin);
+ CloseHandle(writestdin);
+ CloseHandle(newstdout);
+ CloseHandle(readstdout);
+ return pxCreateProcessFailed;
+ }
+
+ inputpos=ainput;
+
+ while(TRUE)
+ {
+ success=GetExitCodeProcess(processinformation.hProcess, aexitcode);
+ if ((success)&&(*aexitcode!=STILL_ACTIVE)) break;
+
+ storeOutput(readstdout, aoutput);
+
+ if (*inputpos!='\0') size=1;
+ else size=0;
+
+ success=WriteFile(writestdin, inputpos, size, &transfered, NULL);
+
+ inputpos+=transfered;
+ }
+
+ storeOutput(readstdout, aoutput);
+ WaitForSingleObject(processinformation.hProcess, INFINITE);
+
+ LogMessage("output:\n", *aoutput, "");
+
+ CloseHandle(processinformation.hThread);
+ CloseHandle(processinformation.hProcess);
+ CloseHandle(newstdin);
+ CloseHandle(newstdout);
+ CloseHandle(readstdout);
+ CloseHandle(writestdin);
+
+ return pxSuccess;
+}
+
diff --git a/plugins/CryptoPP/src/GPGw/pipeexec.h b/plugins/CryptoPP/src/GPGw/pipeexec.h new file mode 100644 index 0000000000..241e071a53 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/pipeexec.h @@ -0,0 +1,24 @@ +#ifndef __PIPEEXEC_H__
+#define __PIPEEXEC_H__
+
+#include <windows.h>
+
+// typen
+typedef enum
+{
+ pxSuccess,
+ pxSuccessExitCodeInvalid,
+ pxCreatePipeFailed,
+ pxDuplicateHandleFailed,
+ pxCloseHandleFailed,
+ pxCreateProcessFailed,
+ pxThreadWaitFailed,
+ pxReadFileFailed,
+ pxBufferOverflow
+}
+pxResult;
+
+pxResult pxExecute(char *acommandline, char *ainput, char **aoutput, LPDWORD aexitcode);
+
+#endif // __PIPEEXEC_H__
+
diff --git a/plugins/CryptoPP/src/GPGw/resource.h b/plugins/CryptoPP/src/GPGw/resource.h new file mode 100644 index 0000000000..af5efe29d7 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/resource.h @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by resource.rc
+//
+#define IDD_PASSPHRASE 101
+#define IDD_SELECTKEY 102
+#define IDC_PASSPHRASE 1000
+#define IDC_USERID 1001
+#define IDC_KEYLIST 1002
+#define IDC_REFRESH 1003
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 103
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1004
+#define _APS_NEXT_SYMED_VALUE 103
+#endif
+#endif
diff --git a/plugins/CryptoPP/src/GPGw/resource.rc b/plugins/CryptoPP/src/GPGw/resource.rc new file mode 100644 index 0000000000..53968a5d2e --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/resource.rc @@ -0,0 +1,112 @@ +// 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
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1251)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_PASSPHRASE DIALOG 0, 0, 238, 46
+STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "GnuPG Plugin - Passphrase"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "Enter passphrase for the secret key of user:", IDC_STATIC,6,4,168,8
+ LTEXT "User ID",IDC_USERID,6,14,168,8
+ EDITTEXT IDC_PASSPHRASE,6,24,168,12,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "Ok",IDOK,181,7,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,181,24,50,14
+END
+
+IDD_SELECTKEY DIALOGEX 0, 0, 272, 208
+STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "GnuPG Plugin - Select public key"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CONTROL "",IDC_KEYLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
+ LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,258,174
+ PUSHBUTTON "Refresh",IDC_REFRESH,7,187,50,14
+ DEFPUSHBUTTON "Ok",IDOK,154,187,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,215,187,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_SELECTKEY, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 265
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 201
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#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 // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/CryptoPP/src/GPGw/size.h b/plugins/CryptoPP/src/GPGw/size.h new file mode 100644 index 0000000000..e9382f7a2b --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/size.h @@ -0,0 +1,21 @@ +#ifndef __SIZE_H__
+#define __SIZE_H__
+
+// array groessen
+#define contactsize 256
+#define passphrasesize 256
+#define errormessagesize 512
+#define keybuffersize 8192
+#define fullfilenamesize 1024
+#define argumentsize 512
+#define commandlinesize 2048
+#define linesize 512
+#define filenamesize L_tmpnam
+#define ciphertextsize 16384
+#define plaintextsize 16384
+#define plugintagsize 128
+#define keyuseridsize 512
+#define keyidsize 80
+#define largebuffersize 16384
+
+#endif // __SIZE_H__
diff --git a/plugins/CryptoPP/src/GPGw/tools.c b/plugins/CryptoPP/src/GPGw/tools.c new file mode 100644 index 0000000000..002f18824d --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/tools.c @@ -0,0 +1,191 @@ +#include "commonheaders.h"
+
+// escape sequence type
+struct escapesequence
+{
+ char *sequence;
+ char *code;
+};
+
+// supported escape sequences
+struct escapesequence escsequence[]=
+{
+ {"\\n", "\n"},
+ {"\\r", "\r"},
+ {"\\t", "\t"}
+};
+
+// number of supported escape sequences
+int escsequencecount=sizeof(escsequence)/sizeof(struct escapesequence);
+
+
+void replace(char *atext, const char *apattern, const char *areplacement)
+{
+ char *pos, *last;
+ long textsize;
+ long patternsize;
+ long replacementsize;
+
+ pos=atext;
+ patternsize=strlen(apattern);
+ replacementsize=strlen(areplacement);
+
+ do
+ {
+ // textstelle suchen
+ last=pos;
+ pos=strstr(pos, apattern);
+ // etwas gefunden?
+ if(pos==NULL) break;
+
+ // laenge des textes ermitteln
+ textsize=strlen(last);
+ // platz schaffen
+ memmove(pos+replacementsize, pos+patternsize, textsize-((pos-last)+patternsize)+1);
+ // ersetzen
+ strncpy(pos, areplacement, replacementsize);
+ pos+=replacementsize;
+ }
+ while(pos!=NULL);
+}
+
+
+char *getNextPart(char *aresult, char *atext, const char *aseparator)
+{
+ char *pos;
+
+ strcpy(aresult, "");
+ pos=strstr(atext, aseparator);
+
+ if(pos!=NULL)
+ {
+ strncat(aresult, atext, pos-atext);
+ pos+=strlen(aseparator);
+ }
+ else strcpy(aresult, atext);
+
+ return pos;
+}
+
+
+void getLastPart(char *aresult, char *atext)
+{
+ strcpy(aresult, atext);
+}
+
+
+void appendText(char **abuffer, const char *atext, int atextsize)
+{
+ int size;
+
+ if (*abuffer==NULL) size=0;
+ else size=strlen(*abuffer);
+ size++; // abschliessende 0
+ if(atextsize==0) atextsize=strlen(atext);
+ size+=atextsize;
+
+ *abuffer=(char *)realloc(*abuffer, size);
+ strncat(*abuffer, atext, atextsize);
+}
+
+
+BOOL existsFile(const char *afilename)
+{
+ int attr;
+
+ if(strlen(afilename)==0) return FALSE;
+
+ attr = GetFileAttributes(afilename);
+
+ return ( (attr!=-1) && ((attr&FILE_ATTRIBUTE_DIRECTORY)==0));
+}
+
+
+BOOL existsPath(const char *apathname)
+{
+ int attr;
+
+ if(strlen(apathname)==0) return FALSE;
+
+ attr = GetFileAttributes(apathname);
+
+ return ( (attr!=-1) && (attr&FILE_ATTRIBUTE_DIRECTORY) );
+}
+
+
+BOOL writeToFile(char *afilename, const char *atext)
+{
+ FILE *handle;
+ size_t written;
+ size_t length;
+
+ getTemporaryFileName(afilename);
+
+ handle=fopen(afilename, "wb");
+
+ if(handle==NULL)
+ {
+ LogMessage("--- ", "write to file", "\n");
+ LogMessage("filename:\n", afilename, "\n");
+ return FALSE;
+ }
+
+ length=strlen(atext);
+ written=fwrite(atext, sizeof(char), length, handle);
+
+ if(written!=length) return FALSE;
+
+ fclose(handle);
+ return TRUE;
+}
+
+
+BOOL readFromFile(char *aresult, const char *afilename)
+{
+ FILE *handle;
+ size_t filesize;
+ size_t read;
+
+ handle=fopen(afilename, "rb");
+ if(handle==NULL)
+ {
+ LogMessage("--- ", "read from file", "\n");
+ LogMessage("filename:\n", afilename, "\n");
+ return FALSE;
+ }
+
+ fseek(handle, 0, SEEK_END);
+ filesize=ftell(handle);
+ fseek(handle, 0, SEEK_SET);
+
+ read=fread(aresult, sizeof(char), filesize, handle);
+ if(read!=filesize) return FALSE;
+
+ fclose(handle);
+ return TRUE;
+}
+
+
+void getTemporaryFileName(char *aresult)
+{
+ GetTempFileName(temporarydirectory,"gpg",0,aresult);
+}
+
+
+void quoteEscapeSequences(char *atext)
+{
+ int i;
+
+ for(i=0; i<escsequencecount; i++)
+ replace(atext, escsequence[i].code, escsequence[i].sequence);
+}
+
+
+void unquoteEscapeSequences(char *atext)
+{
+ int i;
+
+ for(i=0; i<escsequencecount; i++)
+ replace(atext, escsequence[i].sequence, escsequence[i].code);
+}
+
diff --git a/plugins/CryptoPP/src/GPGw/tools.h b/plugins/CryptoPP/src/GPGw/tools.h new file mode 100644 index 0000000000..74da8552d3 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/tools.h @@ -0,0 +1,25 @@ +#ifndef __TOOLS_H__
+#define __TOOLS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void replace(char *atext, const char *apattern, const char *areplacement);
+char *getNextPart(char *aresult, char *atext, const char *aseparator);
+void getLastPart(char *aresult, char *atext);
+void appendText(char **abuffer, const char *atext, int atextsize);
+void quoteEscapeSequences(char *atext);
+void unquoteEscapeSequences(char *atext);
+
+BOOL existsFile(const char *afilename);
+BOOL existsPath(const char *apathname);
+BOOL writeToFile(char *afilename, const char *atext);
+BOOL readFromFile(char *aresult, const char *afilename);
+void getTemporaryFileName(char *aresult);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TOOLS_H__
diff --git a/plugins/CryptoPP/src/GPGw/userdialog.c b/plugins/CryptoPP/src/GPGw/userdialog.c new file mode 100644 index 0000000000..bb82917c55 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/userdialog.c @@ -0,0 +1,81 @@ +#include "commonheaders.h"
+
+
+void RefreshListView(HWND hLV);
+
+
+BOOL CALLBACK UserIdDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ static char *keyid;
+ HWND hLV = GetDlgItem(hdlg,IDC_KEYLIST);
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ {
+ int i;
+ LVCOLUMN lvc;
+ static char *szColHdr[] = { "Key ID", "User ID" };
+ static int iColWidth[] = { 110, 255 };
+ keyid = (char *)lparam;
+
+ ZeroMemory(&lvc,sizeof(LVCOLUMN));
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+ lvc.fmt = LVCFMT_LEFT;
+ for (i = 0; i < 2; i++) {
+ lvc.iSubItem = i;
+ lvc.pszText = szColHdr[i];
+ lvc.cx = iColWidth[i];
+ ListView_InsertColumn(hLV, i, &lvc);
+ }
+
+ RefreshListView(hLV);
+
+ ListView_SetExtendedListViewStyle(hLV, ListView_GetExtendedListViewStyle(hLV) | LVS_EX_FULLROWSELECT);
+ ListView_SetItemState(hLV, 0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
+ EnableWindow(hLV, TRUE);
+ }
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wparam))
+ {
+ case IDOK:
+ ListView_GetItemText(hLV, ListView_GetNextItem(hLV, -1, LVNI_SELECTED), 0, keyid, keyidsize);
+ case IDCANCEL:
+ EndDialog(hdlg, wparam);
+ return TRUE;
+ break;
+ case IDC_REFRESH:
+ updateKeyUserIDs(publickeyuserid);
+ updateKeyUserIDs(secretkeyuserid);
+ RefreshListView(hLV);
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+
+void RefreshListView(HWND hLV) {
+
+ LVITEM lvi;
+ int i;
+
+ ListView_DeleteAllItems(hLV);
+ ZeroMemory(&lvi,sizeof(LVITEM));
+ lvi.mask = LVIF_TEXT;
+ for (i = 0; i < getKeyUserIDCount(publickeyuserid); i++) {
+
+ char keyid[keyidsize];
+ char *userid;
+ char *keyuserid = getKeyUserID(publickeyuserid, i);
+
+ userid = getNextPart(keyid, keyuserid, txtidseparator);
+
+ lvi.iItem++;
+ lvi.pszText = keyid;
+ ListView_SetItemText(hLV, ListView_InsertItem(hLV, &lvi), 1, userid);
+ }
+}
diff --git a/plugins/CryptoPP/src/GPGw/userdialog.h b/plugins/CryptoPP/src/GPGw/userdialog.h new file mode 100644 index 0000000000..5f49882a29 --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/userdialog.h @@ -0,0 +1,6 @@ +#ifndef __USERDIALOG_H__
+#define __USERDIALOG_H__
+
+BOOL CALLBACK UserIdDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam);
+
+#endif // __USERDIALOG_H__
diff --git a/plugins/CryptoPP/src/PGPw/Release6/PGPsdkW6.dll b/plugins/CryptoPP/src/PGPw/Release6/PGPsdkW6.dll Binary files differnew file mode 100644 index 0000000000..90a7a2abfc --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/Release6/PGPsdkW6.dll diff --git a/plugins/CryptoPP/src/PGPw/Release6/PGPsdkW6.map b/plugins/CryptoPP/src/PGPw/Release6/PGPsdkW6.map new file mode 100644 index 0000000000..6f9fa4584c --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/Release6/PGPsdkW6.map @@ -0,0 +1,213 @@ + PGPsdkW6
+
+ Timestamp is 45ddf356 (Thu Feb 22 22:47:34 2007)
+
+ Preferred load address is 46600000
+
+ Start Length Name Class
+ 0001:00000000 0000003cH .idata$5 CODE
+ 0001:00000040 0000003eH .rdata CODE
+ 0001:00000080 00000d81H .text CODE
+ 0001:00000e04 00000040H .didat$2 CODE
+ 0001:00000e44 00000020H .didat$3 CODE
+ 0001:00000e64 000000a0H .didat$4 CODE
+ 0001:00000f04 000002ceH .didat$6 CODE
+ 0001:000011d4 000000a0H .didat$7 CODE
+ 0001:00001274 0000003cH .idata$2 CODE
+ 0001:000012b0 00000014H .idata$3 CODE
+ 0001:000012c4 0000003cH .idata$4 CODE
+ 0001:00001300 000000e0H .idata$6 CODE
+ 0001:000013e0 00000172H .edata CODE
+ 0002:00000000 00000090H .data DATA
+ 0002:00000090 000000a0H .didat$5 DATA
+ 0002:00000130 00000050H .bss DATA
+
+ Address Publics by Value Rva+Base Lib:Object
+
+ 0001:00000000 __imp__LocalAlloc@8 46601000 kernel32:KERNEL32.dll
+ 0001:00000004 __imp__LocalFree@4 46601004 kernel32:KERNEL32.dll
+ 0001:00000008 __imp__lstrlenA@4 46601008 kernel32:KERNEL32.dll
+ 0001:0000000c __imp__GetLastError@0 4660100c kernel32:KERNEL32.dll
+ 0001:00000010 __imp__RaiseException@16 46601010 kernel32:KERNEL32.dll
+ 0001:00000014 __imp__InterlockedExchange@8 46601014 kernel32:KERNEL32.dll
+ 0001:00000018 __imp__LoadLibraryA@4 46601018 kernel32:KERNEL32.dll
+ 0001:0000001c __imp__FreeLibrary@4 4660101c kernel32:KERNEL32.dll
+ 0001:00000020 __imp__GetProcAddress@8 46601020 kernel32:KERNEL32.dll
+ 0001:00000024 \177KERNEL32_NULL_THUNK_DATA 46601024 kernel32:KERNEL32.dll
+ 0001:00000028 __imp___except_handler3 46601028 msvcrt:MSVCRT.dll
+ 0001:0000002c __imp__memmove 4660102c msvcrt:MSVCRT.dll
+ 0001:00000030 \177MSVCRT_NULL_THUNK_DATA 46601030 msvcrt:MSVCRT.dll
+ 0001:00000034 __imp__MessageBoxA@16 46601034 user32:USER32.dll
+ 0001:00000038 \177USER32_NULL_THUNK_DATA 46601038 user32:USER32.dll
+ 0001:00000060 __sz_PGP_SDK 46601060 pgp_sdk:PGP_SDK.dll
+ 0001:00000070 __sz_PGPsdkUI 46601070 pgpsdkui:PGPsdkUI.dll
+ 0001:00000080 ?ClearPGPError@@YAXXZ 46601080 f main.obj
+ 0001:00000089 ?CheckPGPError@@YA_NH@Z 46601089 f main.obj
+ 0001:000000b5 __pgp_init 466010b5 f main.obj
+ 0001:000001be __pgp_done 466011be f main.obj
+ 0001:00000271 __pgp_open_keyrings 46601271 f main.obj
+ 0001:00000297 __pgp_close_keyrings 46601297 f main.obj
+ 0001:000002b2 __pgp_get_version 466012b2 f main.obj
+ 0001:000002b8 __pgp_get_error 466012b8 f main.obj
+ 0001:000002be __pgp_encrypt_keydb 466012be f main.obj
+ 0001:000003dc __pgp_decrypt_keydb 466013dc f main.obj
+ 0001:00000528 ?_pgp_import_key@@YAHPAPAUPGPKeySet@@PBD@Z 46601528 f main.obj
+ 0001:00000566 __pgp_encrypt_key 46601566 f main.obj
+ 0001:00000683 __pgp_decrypt_key 46601683 f main.obj
+ 0001:0000080b __pgp_size_keyid 4660180b f main.obj
+ 0001:0000080f __pgp_select_keyid 4660180f f main.obj
+ 0001:000008fb ?dllmain@@YGHPAUHINSTANCE__@@KPAX@Z 466018fb f main.obj
+ 0001:0000090a __imp_load__PGPGetErrorString 4660190a pgp_sdk:PGP_SDK.dll
+ 0001:00000916 __tailMerge_PGP_SDK 46601916 pgp_sdk:PGP_SDK.dll
+ 0001:00000924 _PGPGetErrorString 46601924 pgp_sdk:PGP_SDK.dll
+ 0001:0000092a __imp_load__PGPGetSDKVersion 4660192a pgp_sdk:PGP_SDK.dll
+ 0001:00000936 _PGPGetSDKVersion 46601936 pgp_sdk:PGP_SDK.dll
+ 0001:0000093c __imp_load__PGPNewContext 4660193c pgp_sdk:PGP_SDK.dll
+ 0001:00000948 _PGPNewContext 46601948 pgp_sdk:PGP_SDK.dll
+ 0001:0000094e __imp_load__PGPsdkInit 4660194e pgp_sdk:PGP_SDK.dll
+ 0001:0000095a _PGPsdkInit 4660195a pgp_sdk:PGP_SDK.dll
+ 0001:00000960 __imp_load__PGPsdkCleanup 46601960 pgp_sdk:PGP_SDK.dll
+ 0001:0000096c _PGPsdkCleanup 4660196c pgp_sdk:PGP_SDK.dll
+ 0001:00000972 __imp_load__PGPFreeContext 46601972 pgp_sdk:PGP_SDK.dll
+ 0001:0000097e _PGPFreeContext 4660197e pgp_sdk:PGP_SDK.dll
+ 0001:00000984 __imp_load__PGPFreeKeySet 46601984 pgp_sdk:PGP_SDK.dll
+ 0001:00000990 _PGPFreeKeySet 46601990 pgp_sdk:PGP_SDK.dll
+ 0001:00000996 __imp_load__PGPFreeData 46601996 pgp_sdk:PGP_SDK.dll
+ 0001:000009a2 _PGPFreeData 466019a2 pgp_sdk:PGP_SDK.dll
+ 0001:000009a8 __imp_load__PGPOpenDefaultKeyRings 466019a8 pgp_sdk:PGP_SDK.dll
+ 0001:000009b4 _PGPOpenDefaultKeyRings 466019b4 pgp_sdk:PGP_SDK.dll
+ 0001:000009ba __imp_load__PGPFreeFilter 466019ba pgp_sdk:PGP_SDK.dll
+ 0001:000009c6 _PGPFreeFilter 466019c6 pgp_sdk:PGP_SDK.dll
+ 0001:000009cc __imp_load__PGPEncode 466019cc pgp_sdk:PGP_SDK.dll
+ 0001:000009d8 _PGPEncode 466019d8 pgp_sdk:PGP_SDK.dll
+ 0001:000009de __imp_load__PGPOInputBuffer 466019de pgp_sdk:PGP_SDK.dll
+ 0001:000009ea _PGPOInputBuffer 466019ea pgp_sdk:PGP_SDK.dll
+ 0001:000009f0 __imp_load__PGPOArmorOutput 466019f0 pgp_sdk:PGP_SDK.dll
+ 0001:000009fc _PGPOArmorOutput 466019fc pgp_sdk:PGP_SDK.dll
+ 0001:00000a02 __imp_load__PGPOAllocatedOutputBuffer 46601a02 pgp_sdk:PGP_SDK.dll
+ 0001:00000a0e _PGPOAllocatedOutputBuffer 46601a0e pgp_sdk:PGP_SDK.dll
+ 0001:00000a14 __imp_load__PGPOEncryptToKeySet 46601a14 pgp_sdk:PGP_SDK.dll
+ 0001:00000a20 _PGPOEncryptToKeySet 46601a20 pgp_sdk:PGP_SDK.dll
+ 0001:00000a26 __imp_load__PGPOVersionString 46601a26 pgp_sdk:PGP_SDK.dll
+ 0001:00000a32 _PGPOVersionString 46601a32 pgp_sdk:PGP_SDK.dll
+ 0001:00000a38 __imp_load__PGPOLastOption 46601a38 pgp_sdk:PGP_SDK.dll
+ 0001:00000a44 _PGPOLastOption 46601a44 pgp_sdk:PGP_SDK.dll
+ 0001:00000a4a __imp_load__PGPFilterKeySet 46601a4a pgp_sdk:PGP_SDK.dll
+ 0001:00000a56 _PGPFilterKeySet 46601a56 pgp_sdk:PGP_SDK.dll
+ 0001:00000a5c __imp_load__PGPNewKeyIDFilter 46601a5c pgp_sdk:PGP_SDK.dll
+ 0001:00000a68 _PGPNewKeyIDFilter 46601a68 pgp_sdk:PGP_SDK.dll
+ 0001:00000a6e __imp_load__PGPDecode 46601a6e pgp_sdk:PGP_SDK.dll
+ 0001:00000a7a _PGPDecode 46601a7a pgp_sdk:PGP_SDK.dll
+ 0001:00000a80 __imp_load__PGPOKeySetRef 46601a80 pgp_sdk:PGP_SDK.dll
+ 0001:00000a8c _PGPOKeySetRef 46601a8c pgp_sdk:PGP_SDK.dll
+ 0001:00000a92 __imp_load__PGPOPassphrase 46601a92 pgp_sdk:PGP_SDK.dll
+ 0001:00000a9e _PGPOPassphrase 46601a9e pgp_sdk:PGP_SDK.dll
+ 0001:00000aa4 __imp_load__PGPImportKeySet 46601aa4 pgp_sdk:PGP_SDK.dll
+ 0001:00000ab0 _PGPImportKeySet 46601ab0 pgp_sdk:PGP_SDK.dll
+ 0001:00000ab6 __imp_load__PGPCountKeys 46601ab6 pgp_sdk:PGP_SDK.dll
+ 0001:00000ac2 _PGPCountKeys 46601ac2 pgp_sdk:PGP_SDK.dll
+ 0001:00000ac8 __imp_load__PGPFreeKeyIter 46601ac8 pgp_sdk:PGP_SDK.dll
+ 0001:00000ad4 _PGPFreeKeyIter 46601ad4 pgp_sdk:PGP_SDK.dll
+ 0001:00000ada __imp_load__PGPFreeKeyList 46601ada pgp_sdk:PGP_SDK.dll
+ 0001:00000ae6 _PGPFreeKeyList 46601ae6 pgp_sdk:PGP_SDK.dll
+ 0001:00000aec __imp_load__PGPGetKeyIDString 46601aec pgp_sdk:PGP_SDK.dll
+ 0001:00000af8 _PGPGetKeyIDString 46601af8 pgp_sdk:PGP_SDK.dll
+ 0001:00000afe __imp_load__PGPGetKeyIDFromKey 46601afe pgp_sdk:PGP_SDK.dll
+ 0001:00000b0a _PGPGetKeyIDFromKey 46601b0a pgp_sdk:PGP_SDK.dll
+ 0001:00000b10 __imp_load__PGPKeyIterNext 46601b10 pgp_sdk:PGP_SDK.dll
+ 0001:00000b1c _PGPKeyIterNext 46601b1c pgp_sdk:PGP_SDK.dll
+ 0001:00000b22 __imp_load__PGPNewKeyIter 46601b22 pgp_sdk:PGP_SDK.dll
+ 0001:00000b2e _PGPNewKeyIter 46601b2e pgp_sdk:PGP_SDK.dll
+ 0001:00000b34 __imp_load__PGPOrderKeySet 46601b34 pgp_sdk:PGP_SDK.dll
+ 0001:00000b40 _PGPOrderKeySet 46601b40 pgp_sdk:PGP_SDK.dll
+ 0001:00000b46 __imp_load__PGPsdkUILibInit 46601b46 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b52 __tailMerge_PGPsdkUI 46601b52 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b60 _PGPsdkUILibInit 46601b60 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b66 __imp_load__PGPsdkUILibCleanup 46601b66 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b72 _PGPsdkUILibCleanup 46601b72 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b78 __imp_load__PGPPassphraseDialog 46601b78 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b84 _PGPPassphraseDialog 46601b84 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b8a __imp_load__PGPOUIOutputPassphrase 46601b8a pgpsdkui:PGPsdkUI.dll
+ 0001:00000b96 _PGPOUIOutputPassphrase 46601b96 pgpsdkui:PGPsdkUI.dll
+ 0001:00000b9c __imp_load__PGPRecipientDialog 46601b9c pgpsdkui:PGPsdkUI.dll
+ 0001:00000ba8 _PGPRecipientDialog 46601ba8 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bae __imp_load__PGPOUIParentWindowHandle 46601bae pgpsdkui:PGPsdkUI.dll
+ 0001:00000bba _PGPOUIParentWindowHandle 46601bba pgpsdkui:PGPsdkUI.dll
+ 0001:00000bc0 __imp_load__PGPOUIWindowTitle 46601bc0 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bcc _PGPOUIWindowTitle 46601bcc pgpsdkui:PGPsdkUI.dll
+ 0001:00000be0 __except_handler3 46601be0 f msvcrt:MSVCRT.dll
+ 0001:00000be6 ___delayLoadHelper@8 46601be6 f delayimp:delayhlp.obj
+ 0001:00000e04 __DELAY_IMPORT_DESCRIPTOR_PGP_SDK 46601e04 pgp_sdk:PGP_SDK.dll
+ 0001:00000e24 __DELAY_IMPORT_DESCRIPTOR_PGPsdkUI 46601e24 pgpsdkui:PGPsdkUI.dll
+ 0001:00000e44 __NULL_DELAY_IMPORT_DESCRIPTOR 46601e44 pgp_sdk:PGP_SDK.dll
+ 0001:00000ee0 \177PGP_SDK_NULL_THUNK_DATA_DLN 46601ee0 pgp_sdk:PGP_SDK.dll
+ 0001:00000f00 \177PGPsdkUI_NULL_THUNK_DATA_DLN 46601f00 pgpsdkui:PGPsdkUI.dll
+ 0001:000011d8 \177PGP_SDK_NULL_THUNK_DATA_DLB 466021d8 pgp_sdk:PGP_SDK.dll
+ 0001:00001258 \177PGPsdkUI_NULL_THUNK_DATA_DLB 46602258 pgpsdkui:PGPsdkUI.dll
+ 0001:00001274 __IMPORT_DESCRIPTOR_KERNEL32 46602274 kernel32:KERNEL32.dll
+ 0001:00001288 __IMPORT_DESCRIPTOR_USER32 46602288 user32:USER32.dll
+ 0001:0000129c __IMPORT_DESCRIPTOR_MSVCRT 4660229c msvcrt:MSVCRT.dll
+ 0001:000012b0 __NULL_IMPORT_DESCRIPTOR 466022b0 kernel32:KERNEL32.dll
+ 0002:00000000 ?szModuleName@@3PBDB 46603000 commonheaders.obj
+ 0002:00000004 ?szVersionStr@@3PBDB 46603004 commonheaders.obj
+ 0002:00000008 ??_C@_0BG@HGBA@PGPsdk?5DLL?5?$CI1?40?41?411?$CJ?$AA@ 46603008 commonheaders.obj
+ 0002:00000020 ??_C@_06DDFD@PGPsdk?$AA@ 46603020 commonheaders.obj
+ 0002:00000028 ??_C@_0EB@DOFC@You?5selected?5more?5than?5one?5key?4?5@ 46603028 main.obj
+ 0002:0000006c ??_C@_0BF@LLHL@Select?5Contact?8s?5Key?$AA@ 4660306c main.obj
+ 0002:00000090 __imp__PGPGetErrorString 46603090 pgp_sdk:PGP_SDK.dll
+ 0002:00000094 __imp__PGPGetSDKVersion 46603094 pgp_sdk:PGP_SDK.dll
+ 0002:00000098 __imp__PGPNewContext 46603098 pgp_sdk:PGP_SDK.dll
+ 0002:0000009c __imp__PGPsdkInit 4660309c pgp_sdk:PGP_SDK.dll
+ 0002:000000a0 __imp__PGPsdkCleanup 466030a0 pgp_sdk:PGP_SDK.dll
+ 0002:000000a4 __imp__PGPFreeContext 466030a4 pgp_sdk:PGP_SDK.dll
+ 0002:000000a8 __imp__PGPFreeKeySet 466030a8 pgp_sdk:PGP_SDK.dll
+ 0002:000000ac __imp__PGPFreeData 466030ac pgp_sdk:PGP_SDK.dll
+ 0002:000000b0 __imp__PGPOpenDefaultKeyRings 466030b0 pgp_sdk:PGP_SDK.dll
+ 0002:000000b4 __imp__PGPFreeFilter 466030b4 pgp_sdk:PGP_SDK.dll
+ 0002:000000b8 __imp__PGPEncode 466030b8 pgp_sdk:PGP_SDK.dll
+ 0002:000000bc __imp__PGPOInputBuffer 466030bc pgp_sdk:PGP_SDK.dll
+ 0002:000000c0 __imp__PGPOArmorOutput 466030c0 pgp_sdk:PGP_SDK.dll
+ 0002:000000c4 __imp__PGPOAllocatedOutputBuffer 466030c4 pgp_sdk:PGP_SDK.dll
+ 0002:000000c8 __imp__PGPOEncryptToKeySet 466030c8 pgp_sdk:PGP_SDK.dll
+ 0002:000000cc __imp__PGPOVersionString 466030cc pgp_sdk:PGP_SDK.dll
+ 0002:000000d0 __imp__PGPOLastOption 466030d0 pgp_sdk:PGP_SDK.dll
+ 0002:000000d4 __imp__PGPFilterKeySet 466030d4 pgp_sdk:PGP_SDK.dll
+ 0002:000000d8 __imp__PGPNewKeyIDFilter 466030d8 pgp_sdk:PGP_SDK.dll
+ 0002:000000dc __imp__PGPDecode 466030dc pgp_sdk:PGP_SDK.dll
+ 0002:000000e0 __imp__PGPOKeySetRef 466030e0 pgp_sdk:PGP_SDK.dll
+ 0002:000000e4 __imp__PGPOPassphrase 466030e4 pgp_sdk:PGP_SDK.dll
+ 0002:000000e8 __imp__PGPImportKeySet 466030e8 pgp_sdk:PGP_SDK.dll
+ 0002:000000ec __imp__PGPCountKeys 466030ec pgp_sdk:PGP_SDK.dll
+ 0002:000000f0 __imp__PGPFreeKeyIter 466030f0 pgp_sdk:PGP_SDK.dll
+ 0002:000000f4 __imp__PGPFreeKeyList 466030f4 pgp_sdk:PGP_SDK.dll
+ 0002:000000f8 __imp__PGPGetKeyIDString 466030f8 pgp_sdk:PGP_SDK.dll
+ 0002:000000fc __imp__PGPGetKeyIDFromKey 466030fc pgp_sdk:PGP_SDK.dll
+ 0002:00000100 __imp__PGPKeyIterNext 46603100 pgp_sdk:PGP_SDK.dll
+ 0002:00000104 __imp__PGPNewKeyIter 46603104 pgp_sdk:PGP_SDK.dll
+ 0002:00000108 __imp__PGPOrderKeySet 46603108 pgp_sdk:PGP_SDK.dll
+ 0002:0000010c \177PGP_SDK_NULL_THUNK_DATA_DLA 4660310c pgp_sdk:PGP_SDK.dll
+ 0002:00000110 __imp__PGPsdkUILibCleanup 46603110 pgpsdkui:PGPsdkUI.dll
+ 0002:00000114 __imp__PGPPassphraseDialog 46603114 pgpsdkui:PGPsdkUI.dll
+ 0002:00000118 __imp__PGPOUIOutputPassphrase 46603118 pgpsdkui:PGPsdkUI.dll
+ 0002:0000011c __imp__PGPRecipientDialog 4660311c pgpsdkui:PGPsdkUI.dll
+ 0002:00000120 __imp__PGPOUIParentWindowHandle 46603120 pgpsdkui:PGPsdkUI.dll
+ 0002:00000124 __imp__PGPOUIWindowTitle 46603124 pgpsdkui:PGPsdkUI.dll
+ 0002:00000128 __imp__PGPsdkUILibInit 46603128 pgpsdkui:PGPsdkUI.dll
+ 0002:0000012c \177PGPsdkUI_NULL_THUNK_DATA_DLA 4660312c pgpsdkui:PGPsdkUI.dll
+ 0002:00000130 ?g_hInst@@3PAUHINSTANCE__@@A 46603130 commonheaders.obj
+ 0002:00000158 ?pgpVer@@3IA 46603158 main.obj
+ 0002:0000015c ?pgpContext@@3PAUPGPContext@@A 4660315c main.obj
+ 0002:00000160 ?pgpKeyDB@@3PAUPGPKeySet@@A 46603160 main.obj
+ 0002:00000164 ?pszPassphrase@@3PADA 46603164 main.obj
+ 0002:00000168 ?pgpErrMsg@@3PADA 46603168 main.obj
+ 0002:0000016c __hmod__PGP_SDK 4660316c pgp_sdk:PGP_SDK.dll
+ 0002:00000170 __hmod__PGPSDKUI 46603170 pgpsdkui:PGPsdkUI.dll
+ 0002:00000174 ___puiHead 46603174 delayimp:delayhlp.obj
+ 0002:00000178 ___pfnDliFailureHook 46603178 delayimp:delayhk1.obj
+ 0002:0000017c ___pfnDliNotifyHook 4660317c delayimp:delayhk2.obj
+
+ entry point at 0000:00000000
+
+ Static symbols
+
+ 0001:00000ddf ?OverlayIAT@@YGXPAU_IMAGE_THUNK_DATA32@@PBU1@@Z 46601ddf f delayimp:delayhlp.obj
diff --git a/plugins/CryptoPP/src/PGPw/Release8/PGPsdkW8.dll b/plugins/CryptoPP/src/PGPw/Release8/PGPsdkW8.dll Binary files differnew file mode 100644 index 0000000000..f026dde7fd --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/Release8/PGPsdkW8.dll diff --git a/plugins/CryptoPP/src/PGPw/Release8/PGPsdkW8.map b/plugins/CryptoPP/src/PGPw/Release8/PGPsdkW8.map new file mode 100644 index 0000000000..e6ccff0c57 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/Release8/PGPsdkW8.map @@ -0,0 +1,216 @@ + PGPsdkW8
+
+ Timestamp is 45ddf360 (Thu Feb 22 22:47:44 2007)
+
+ Preferred load address is 46800000
+
+ Start Length Name Class
+ 0001:00000000 00000044H .idata$5 CODE
+ 0001:00000050 0000003eH .rdata CODE
+ 0001:00000090 00000dd1H .text CODE
+ 0001:00000e64 00000040H .didat$2 CODE
+ 0001:00000ea4 00000020H .didat$3 CODE
+ 0001:00000ec4 00000098H .didat$4 CODE
+ 0001:00000f5c 000002d0H .didat$6 CODE
+ 0001:0000122c 00000098H .didat$7 CODE
+ 0001:000012c4 00000050H .idata$2 CODE
+ 0001:00001314 00000014H .idata$3 CODE
+ 0001:00001328 00000044H .idata$4 CODE
+ 0001:0000136c 00000102H .idata$6 CODE
+ 0001:00001470 00000172H .edata CODE
+ 0002:00000000 00000130H .data DATA
+ 0002:00000130 00000098H .didat$5 DATA
+ 0002:000001c8 00000050H .bss DATA
+
+ Address Publics by Value Rva+Base Lib:Object
+
+ 0001:00000000 __imp__LocalAlloc@8 46801000 kernel32:KERNEL32.dll
+ 0001:00000004 __imp__LocalFree@4 46801004 kernel32:KERNEL32.dll
+ 0001:00000008 __imp__lstrlenA@4 46801008 kernel32:KERNEL32.dll
+ 0001:0000000c __imp__GetLastError@0 4680100c kernel32:KERNEL32.dll
+ 0001:00000010 __imp__RaiseException@16 46801010 kernel32:KERNEL32.dll
+ 0001:00000014 __imp__InterlockedExchange@8 46801014 kernel32:KERNEL32.dll
+ 0001:00000018 __imp__FreeLibrary@4 46801018 kernel32:KERNEL32.dll
+ 0001:0000001c __imp__LoadLibraryA@4 4680101c kernel32:KERNEL32.dll
+ 0001:00000020 __imp__GetProcAddress@8 46801020 kernel32:KERNEL32.dll
+ 0001:00000024 \177KERNEL32_NULL_THUNK_DATA 46801024 kernel32:KERNEL32.dll
+ 0001:00000028 __imp__memmove 46801028 msvcrt:MSVCRT.dll
+ 0001:0000002c __imp___except_handler3 4680102c msvcrt:MSVCRT.dll
+ 0001:00000030 \177MSVCRT_NULL_THUNK_DATA 46801030 msvcrt:MSVCRT.dll
+ 0001:00000034 __imp__MessageBoxA@16 46801034 user32:USER32.dll
+ 0001:00000038 \177USER32_NULL_THUNK_DATA 46801038 user32:USER32.dll
+ 0001:0000003c __imp__GetOpenFileNameA@4 4680103c comdlg32:comdlg32.dll
+ 0001:00000040 \177comdlg32_NULL_THUNK_DATA 46801040 comdlg32:comdlg32.dll
+ 0001:00000070 __sz_PGPsdk 46801070 pgpsdk:PGPsdk.dll
+ 0001:00000080 __sz_PGPsdkUI 46801080 pgpsdkui:PGPsdkUI.dll
+ 0001:00000090 ?ClearPGPError@@YAXXZ 46801090 f main.obj
+ 0001:00000099 ?CheckPGPError@@YA_NH@Z 46801099 f main.obj
+ 0001:000000c5 __pgp_init 468010c5 f main.obj
+ 0001:00000173 __pgp_done 46801173 f main.obj
+ 0001:00000226 __pgp_open_keyrings 46801226 f main.obj
+ 0001:000002ac __pgp_close_keyrings 468012ac f main.obj
+ 0001:000002c7 __pgp_get_version 468012c7 f main.obj
+ 0001:000002cd __pgp_get_error 468012cd f main.obj
+ 0001:000002d3 __pgp_encrypt_keydb 468012d3 f main.obj
+ 0001:000003c8 __pgp_decrypt_keydb 468013c8 f main.obj
+ 0001:00000514 ?_pgp_import_key@@YAHPAPAUPGPKeyDB@@PBD@Z 46801514 f main.obj
+ 0001:00000552 __pgp_encrypt_key 46801552 f main.obj
+ 0001:0000069b __pgp_decrypt_key 4680169b f main.obj
+ 0001:00000823 __pgp_size_keyid 46801823 f main.obj
+ 0001:00000827 __pgp_select_keyid 46801827 f main.obj
+ 0001:0000090a ?ShowSelectKeyringsDlg@@YAHPAUHWND__@@PAD1@Z 4680190a f main.obj
+ 0001:0000097f ?dllmain@@YGHPAUHINSTANCE__@@KPAX@Z 4680197f f main.obj
+ 0001:0000098e __imp_load__PGPGetErrorString 4680198e pgpsdk:PGPsdk.dll
+ 0001:0000099a __tailMerge_PGPsdk 4680199a pgpsdk:PGPsdk.dll
+ 0001:000009a8 _PGPGetErrorString 468019a8 pgpsdk:PGPsdk.dll
+ 0001:000009ae __imp_load__PGPGetPGPsdkVersion 468019ae pgpsdk:PGPsdk.dll
+ 0001:000009ba _PGPGetPGPsdkVersion 468019ba pgpsdk:PGPsdk.dll
+ 0001:000009c0 __imp_load__PGPNewContext 468019c0 pgpsdk:PGPsdk.dll
+ 0001:000009cc _PGPNewContext 468019cc pgpsdk:PGPsdk.dll
+ 0001:000009d2 __imp_load__PGPsdkInit 468019d2 pgpsdk:PGPsdk.dll
+ 0001:000009de _PGPsdkInit 468019de pgpsdk:PGPsdk.dll
+ 0001:000009e4 __imp_load__PGPsdkCleanup 468019e4 pgpsdk:PGPsdk.dll
+ 0001:000009f0 _PGPsdkCleanup 468019f0 pgpsdk:PGPsdk.dll
+ 0001:000009f6 __imp_load__PGPFreeContext 468019f6 pgpsdk:PGPsdk.dll
+ 0001:00000a02 _PGPFreeContext 46801a02 pgpsdk:PGPsdk.dll
+ 0001:00000a08 __imp_load__PGPFreeKeyDB 46801a08 pgpsdk:PGPsdk.dll
+ 0001:00000a14 _PGPFreeKeyDB 46801a14 pgpsdk:PGPsdk.dll
+ 0001:00000a1a __imp_load__PGPFreeData 46801a1a pgpsdk:PGPsdk.dll
+ 0001:00000a26 _PGPFreeData 46801a26 pgpsdk:PGPsdk.dll
+ 0001:00000a2c __imp_load__PGPFreeFileSpec 46801a2c pgpsdk:PGPsdk.dll
+ 0001:00000a38 _PGPFreeFileSpec 46801a38 pgpsdk:PGPsdk.dll
+ 0001:00000a3e __imp_load__PGPOpenKeyDBFile 46801a3e pgpsdk:PGPsdk.dll
+ 0001:00000a4a _PGPOpenKeyDBFile 46801a4a pgpsdk:PGPsdk.dll
+ 0001:00000a50 __imp_load__PGPNewFileSpecFromFullPath 46801a50 pgpsdk:PGPsdk.dll
+ 0001:00000a5c _PGPNewFileSpecFromFullPath 46801a5c pgpsdk:PGPsdk.dll
+ 0001:00000a62 __imp_load__PGPEncode 46801a62 pgpsdk:PGPsdk.dll
+ 0001:00000a6e _PGPEncode 46801a6e pgpsdk:PGPsdk.dll
+ 0001:00000a74 __imp_load__PGPOInputBuffer 46801a74 pgpsdk:PGPsdk.dll
+ 0001:00000a80 _PGPOInputBuffer 46801a80 pgpsdk:PGPsdk.dll
+ 0001:00000a86 __imp_load__PGPOArmorOutput 46801a86 pgpsdk:PGPsdk.dll
+ 0001:00000a92 _PGPOArmorOutput 46801a92 pgpsdk:PGPsdk.dll
+ 0001:00000a98 __imp_load__PGPOAllocatedOutputBuffer 46801a98 pgpsdk:PGPsdk.dll
+ 0001:00000aa4 _PGPOAllocatedOutputBuffer 46801aa4 pgpsdk:PGPsdk.dll
+ 0001:00000aaa __imp_load__PGPOEncryptToKeyDBObj 46801aaa pgpsdk:PGPsdk.dll
+ 0001:00000ab6 _PGPOEncryptToKeyDBObj 46801ab6 pgpsdk:PGPsdk.dll
+ 0001:00000abc __imp_load__PGPOVersionString 46801abc pgpsdk:PGPsdk.dll
+ 0001:00000ac8 _PGPOVersionString 46801ac8 pgpsdk:PGPsdk.dll
+ 0001:00000ace __imp_load__PGPOLastOption 46801ace pgpsdk:PGPsdk.dll
+ 0001:00000ada _PGPOLastOption 46801ada pgpsdk:PGPsdk.dll
+ 0001:00000ae0 __imp_load__PGPFindKeyByKeyID 46801ae0 pgpsdk:PGPsdk.dll
+ 0001:00000aec _PGPFindKeyByKeyID 46801aec pgpsdk:PGPsdk.dll
+ 0001:00000af2 __imp_load__PGPDecode 46801af2 pgpsdk:PGPsdk.dll
+ 0001:00000afe _PGPDecode 46801afe pgpsdk:PGPsdk.dll
+ 0001:00000b04 __imp_load__PGPOKeyDBRef 46801b04 pgpsdk:PGPsdk.dll
+ 0001:00000b10 _PGPOKeyDBRef 46801b10 pgpsdk:PGPsdk.dll
+ 0001:00000b16 __imp_load__PGPOPassphrase 46801b16 pgpsdk:PGPsdk.dll
+ 0001:00000b22 _PGPOPassphrase 46801b22 pgpsdk:PGPsdk.dll
+ 0001:00000b28 __imp_load__PGPImport 46801b28 pgpsdk:PGPsdk.dll
+ 0001:00000b34 _PGPImport 46801b34 pgpsdk:PGPsdk.dll
+ 0001:00000b3a __imp_load__PGPFreeKeyIter 46801b3a pgpsdk:PGPsdk.dll
+ 0001:00000b46 _PGPFreeKeyIter 46801b46 pgpsdk:PGPsdk.dll
+ 0001:00000b4c __imp_load__PGPCountKeysInKeyDB 46801b4c pgpsdk:PGPsdk.dll
+ 0001:00000b58 _PGPCountKeysInKeyDB 46801b58 pgpsdk:PGPsdk.dll
+ 0001:00000b5e __imp_load__PGPKeyIterNextKeyDBObj 46801b5e pgpsdk:PGPsdk.dll
+ 0001:00000b6a _PGPKeyIterNextKeyDBObj 46801b6a pgpsdk:PGPsdk.dll
+ 0001:00000b70 __imp_load__PGPNewKeyIterFromKeyDB 46801b70 pgpsdk:PGPsdk.dll
+ 0001:00000b7c _PGPNewKeyIterFromKeyDB 46801b7c pgpsdk:PGPsdk.dll
+ 0001:00000b82 __imp_load__PGPGetKeyIDString 46801b82 pgpsdk:PGPsdk.dll
+ 0001:00000b8e _PGPGetKeyIDString 46801b8e pgpsdk:PGPsdk.dll
+ 0001:00000b94 __imp_load__PGPGetKeyDBObjDataProperty 46801b94 pgpsdk:PGPsdk.dll
+ 0001:00000ba0 _PGPGetKeyDBObjDataProperty 46801ba0 pgpsdk:PGPsdk.dll
+ 0001:00000ba6 __imp_load__PGPsdkUILibInit 46801ba6 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bb2 __tailMerge_PGPsdkUI 46801bb2 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bc0 _PGPsdkUILibInit 46801bc0 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bc6 __imp_load__PGPsdkUILibCleanup 46801bc6 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bd2 _PGPsdkUILibCleanup 46801bd2 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bd8 __imp_load__PGPPassphraseDialog 46801bd8 pgpsdkui:PGPsdkUI.dll
+ 0001:00000be4 _PGPPassphraseDialog 46801be4 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bea __imp_load__PGPOUIOutputPassphrase 46801bea pgpsdkui:PGPsdkUI.dll
+ 0001:00000bf6 _PGPOUIOutputPassphrase 46801bf6 pgpsdkui:PGPsdkUI.dll
+ 0001:00000bfc __imp_load__PGPRecipientDialog 46801bfc pgpsdkui:PGPsdkUI.dll
+ 0001:00000c08 _PGPRecipientDialog 46801c08 pgpsdkui:PGPsdkUI.dll
+ 0001:00000c0e __imp_load__PGPOUIParentWindowHandle 46801c0e pgpsdkui:PGPsdkUI.dll
+ 0001:00000c1a _PGPOUIParentWindowHandle 46801c1a pgpsdkui:PGPsdkUI.dll
+ 0001:00000c20 __imp_load__PGPOUIWindowTitle 46801c20 pgpsdkui:PGPsdkUI.dll
+ 0001:00000c2c _PGPOUIWindowTitle 46801c2c pgpsdkui:PGPsdkUI.dll
+ 0001:00000c32 _GetOpenFileNameA@4 46801c32 f comdlg32:comdlg32.dll
+ 0001:00000c40 __except_handler3 46801c40 f msvcrt:MSVCRT.dll
+ 0001:00000c46 ___delayLoadHelper@8 46801c46 f delayimp:delayhlp.obj
+ 0001:00000e64 __DELAY_IMPORT_DESCRIPTOR_PGPsdk 46801e64 pgpsdk:PGPsdk.dll
+ 0001:00000e84 __DELAY_IMPORT_DESCRIPTOR_PGPsdkUI 46801e84 pgpsdkui:PGPsdkUI.dll
+ 0001:00000ea4 __NULL_DELAY_IMPORT_DESCRIPTOR 46801ea4 pgpsdk:PGPsdk.dll
+ 0001:00000f38 \177PGPsdk_NULL_THUNK_DATA_DLN 46801f38 pgpsdk:PGPsdk.dll
+ 0001:00000f58 \177PGPsdkUI_NULL_THUNK_DATA_DLN 46801f58 pgpsdkui:PGPsdkUI.dll
+ 0001:00001230 \177PGPsdk_NULL_THUNK_DATA_DLB 46802230 pgpsdk:PGPsdk.dll
+ 0001:000012a8 \177PGPsdkUI_NULL_THUNK_DATA_DLB 468022a8 pgpsdkui:PGPsdkUI.dll
+ 0001:000012c4 __IMPORT_DESCRIPTOR_KERNEL32 468022c4 kernel32:KERNEL32.dll
+ 0001:000012d8 __IMPORT_DESCRIPTOR_USER32 468022d8 user32:USER32.dll
+ 0001:000012ec __IMPORT_DESCRIPTOR_comdlg32 468022ec comdlg32:comdlg32.dll
+ 0001:00001300 __IMPORT_DESCRIPTOR_MSVCRT 46802300 msvcrt:MSVCRT.dll
+ 0001:00001314 __NULL_IMPORT_DESCRIPTOR 46802314 kernel32:KERNEL32.dll
+ 0002:00000000 ?szModuleName@@3PBDB 46803000 commonheaders.obj
+ 0002:00000004 ?szVersionStr@@3PBDB 46803004 commonheaders.obj
+ 0002:00000008 ??_C@_0BG@HGBA@PGPsdk?5DLL?5?$CI1?40?41?411?$CJ?$AA@ 46803008 commonheaders.obj
+ 0002:00000020 ??_C@_06DDFD@PGPsdk?$AA@ 46803020 commonheaders.obj
+ 0002:00000028 ??_C@_0EB@DOFC@You?5selected?5more?5than?5one?5key?4?5@ 46803028 main.obj
+ 0002:0000006c ??_C@_0BF@LLHL@Select?5Contact?8s?5Key?$AA@ 4680306c main.obj
+ 0002:00000084 ??_C@_0BE@KDOJ@Open?5Secret?5Keyring?$AA@ 46803084 main.obj
+ 0002:00000098 ??_C@_0EA@KJFM@Secret?5key?5rings?5?$CIsecring?4skr?$CJ?$AAs@ 46803098 main.obj
+ 0002:000000d8 ??_C@_0BE@JBON@Open?5Public?5Keyring?$AA@ 468030d8 main.obj
+ 0002:000000f0 ??_C@_0EA@CLAC@Public?5key?5rings?5?$CIpubring?4pkr?$CJ?$AAp@ 468030f0 main.obj
+ 0002:00000130 __imp__PGPGetErrorString 46803130 pgpsdk:PGPsdk.dll
+ 0002:00000134 __imp__PGPGetPGPsdkVersion 46803134 pgpsdk:PGPsdk.dll
+ 0002:00000138 __imp__PGPNewContext 46803138 pgpsdk:PGPsdk.dll
+ 0002:0000013c __imp__PGPsdkInit 4680313c pgpsdk:PGPsdk.dll
+ 0002:00000140 __imp__PGPsdkCleanup 46803140 pgpsdk:PGPsdk.dll
+ 0002:00000144 __imp__PGPFreeContext 46803144 pgpsdk:PGPsdk.dll
+ 0002:00000148 __imp__PGPFreeKeyDB 46803148 pgpsdk:PGPsdk.dll
+ 0002:0000014c __imp__PGPFreeData 4680314c pgpsdk:PGPsdk.dll
+ 0002:00000150 __imp__PGPFreeFileSpec 46803150 pgpsdk:PGPsdk.dll
+ 0002:00000154 __imp__PGPOpenKeyDBFile 46803154 pgpsdk:PGPsdk.dll
+ 0002:00000158 __imp__PGPNewFileSpecFromFullPath 46803158 pgpsdk:PGPsdk.dll
+ 0002:0000015c __imp__PGPEncode 4680315c pgpsdk:PGPsdk.dll
+ 0002:00000160 __imp__PGPOInputBuffer 46803160 pgpsdk:PGPsdk.dll
+ 0002:00000164 __imp__PGPOArmorOutput 46803164 pgpsdk:PGPsdk.dll
+ 0002:00000168 __imp__PGPOAllocatedOutputBuffer 46803168 pgpsdk:PGPsdk.dll
+ 0002:0000016c __imp__PGPOEncryptToKeyDBObj 4680316c pgpsdk:PGPsdk.dll
+ 0002:00000170 __imp__PGPOVersionString 46803170 pgpsdk:PGPsdk.dll
+ 0002:00000174 __imp__PGPOLastOption 46803174 pgpsdk:PGPsdk.dll
+ 0002:00000178 __imp__PGPFindKeyByKeyID 46803178 pgpsdk:PGPsdk.dll
+ 0002:0000017c __imp__PGPDecode 4680317c pgpsdk:PGPsdk.dll
+ 0002:00000180 __imp__PGPOKeyDBRef 46803180 pgpsdk:PGPsdk.dll
+ 0002:00000184 __imp__PGPOPassphrase 46803184 pgpsdk:PGPsdk.dll
+ 0002:00000188 __imp__PGPImport 46803188 pgpsdk:PGPsdk.dll
+ 0002:0000018c __imp__PGPFreeKeyIter 4680318c pgpsdk:PGPsdk.dll
+ 0002:00000190 __imp__PGPCountKeysInKeyDB 46803190 pgpsdk:PGPsdk.dll
+ 0002:00000194 __imp__PGPKeyIterNextKeyDBObj 46803194 pgpsdk:PGPsdk.dll
+ 0002:00000198 __imp__PGPNewKeyIterFromKeyDB 46803198 pgpsdk:PGPsdk.dll
+ 0002:0000019c __imp__PGPGetKeyIDString 4680319c pgpsdk:PGPsdk.dll
+ 0002:000001a0 __imp__PGPGetKeyDBObjDataProperty 468031a0 pgpsdk:PGPsdk.dll
+ 0002:000001a4 \177PGPsdk_NULL_THUNK_DATA_DLA 468031a4 pgpsdk:PGPsdk.dll
+ 0002:000001a8 __imp__PGPsdkUILibCleanup 468031a8 pgpsdkui:PGPsdkUI.dll
+ 0002:000001ac __imp__PGPPassphraseDialog 468031ac pgpsdkui:PGPsdkUI.dll
+ 0002:000001b0 __imp__PGPOUIOutputPassphrase 468031b0 pgpsdkui:PGPsdkUI.dll
+ 0002:000001b4 __imp__PGPRecipientDialog 468031b4 pgpsdkui:PGPsdkUI.dll
+ 0002:000001b8 __imp__PGPOUIParentWindowHandle 468031b8 pgpsdkui:PGPsdkUI.dll
+ 0002:000001bc __imp__PGPOUIWindowTitle 468031bc pgpsdkui:PGPsdkUI.dll
+ 0002:000001c0 __imp__PGPsdkUILibInit 468031c0 pgpsdkui:PGPsdkUI.dll
+ 0002:000001c4 \177PGPsdkUI_NULL_THUNK_DATA_DLA 468031c4 pgpsdkui:PGPsdkUI.dll
+ 0002:000001c8 ?g_hInst@@3PAUHINSTANCE__@@A 468031c8 commonheaders.obj
+ 0002:000001f0 ?pgpVer@@3IA 468031f0 main.obj
+ 0002:000001f4 ?pgpContext@@3PAUPGPContext@@A 468031f4 main.obj
+ 0002:000001f8 ?pgpKeyDB@@3PAUPGPKeyDB@@A 468031f8 main.obj
+ 0002:000001fc ?pszPassphrase@@3PADA 468031fc main.obj
+ 0002:00000200 ?pgpErrMsg@@3PADA 46803200 main.obj
+ 0002:00000204 __hmod__PGPSDK 46803204 pgpsdk:PGPsdk.dll
+ 0002:00000208 __hmod__PGPSDKUI 46803208 pgpsdkui:PGPsdkUI.dll
+ 0002:0000020c ___puiHead 4680320c delayimp:delayhlp.obj
+ 0002:00000210 ___pfnDliFailureHook 46803210 delayimp:delayhk1.obj
+ 0002:00000214 ___pfnDliNotifyHook 46803214 delayimp:delayhk2.obj
+
+ entry point at 0000:00000000
+
+ Static symbols
+
+ 0001:00000e3f ?OverlayIAT@@YGXPAU_IMAGE_THUNK_DATA32@@PBU1@@Z 46801e3f f delayimp:delayhlp.obj
diff --git a/plugins/CryptoPP/src/PGPw/commonheaders.cpp b/plugins/CryptoPP/src/PGPw/commonheaders.cpp new file mode 100644 index 0000000000..763395fcd6 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/commonheaders.cpp @@ -0,0 +1,5 @@ +#include "commonheaders.h"
+
+LPCSTR szModuleName = MODULENAME;
+LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
+HINSTANCE g_hInst;
diff --git a/plugins/CryptoPP/src/PGPw/commonheaders.h b/plugins/CryptoPP/src/PGPw/commonheaders.h new file mode 100644 index 0000000000..8c79d2ec5c --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/commonheaders.h @@ -0,0 +1,64 @@ +// Windows API
+
+#pragma once
+//#define WIN32_LEAN_AND_MEAN
+//#pragma warning(disable: 4078)
+
+#include <windows.h>
+//#include <afxwin.h>
+#include <commdlg.h>
+#include "..\version.h"
+
+#pragma comment(linker,"/merge:.rdata=.text")
+#pragma comment(linker,"/entry:dllmain")
+#pragma comment(linker,"/nodefaultlib")
+#pragma comment(linker,"/subsystem:windows")
+#pragma optimize("gsy", on)
+
+// PGP API
+#ifndef PGP_WIN32
+#error Define PGP_WIN32 to SDK version (e.g. 0x658)
+#endif
+
+#include <pgpEncode.h>
+#include <pgpErrors.h>
+#include <pgpKeys.h>
+#include <pgpOptionList.h>
+#include <pgpUserInterface.h>
+#include <pgpUtilities.h>
+#include <pgpFeatures.h>
+
+
+#define MODULENAME "PGPsdk"
+BOOL ShowSelectKeyringsDlg(HWND,LPSTR,LPSTR);
+
+extern LPCSTR szModuleName;
+extern LPCSTR szVersionStr;
+extern HINSTANCE g_hInst;
+
+
+#define DLLEXPORT __declspec(dllexport)
+
+extern "C" DLLEXPORT int __cdecl _pgp_init(void);
+extern "C" DLLEXPORT int __cdecl _pgp_done(void);
+extern "C" DLLEXPORT int __cdecl _pgp_open_keyrings(LPSTR,LPSTR);
+extern "C" DLLEXPORT int __cdecl _pgp_close_keyrings(void);
+extern "C" DLLEXPORT int __cdecl _pgp_get_version(void);
+extern "C" DLLEXPORT LPSTR __cdecl _pgp_get_error(void);
+extern "C" DLLEXPORT int __cdecl _pgp_size_keyid(void);
+extern "C" DLLEXPORT PVOID __cdecl _pgp_select_keyid(HWND,LPSTR);
+extern "C" DLLEXPORT LPSTR __cdecl _pgp_encrypt_keydb(LPCSTR,PVOID);
+extern "C" DLLEXPORT LPSTR __cdecl _pgp_decrypt_keydb(LPCSTR);
+//extern "C" DLLEXPORT int __cdecl _pgp_check_key(LPCSTR);
+extern "C" DLLEXPORT LPSTR __cdecl _pgp_encrypt_key(LPCSTR,LPCSTR);
+extern "C" DLLEXPORT LPSTR __cdecl _pgp_decrypt_key(LPCSTR,LPCSTR);
+
+/*
+#undef RtlMoveMemory
+#undef RtlFillMemory
+#undef RtlZeroMemory
+
+NTSYSAPI VOID NTAPI RtlMoveMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, SIZE_T Length);
+NTSYSAPI VOID NTAPI RtlFillMemory(VOID UNALIGNED *Destination, SIZE_T Length, BYTE Fill);
+NTSYSAPI VOID NTAPI RtlZeroMemory(VOID UNALIGNED *Destination, SIZE_T Length);
+*/
diff --git a/plugins/CryptoPP/src/PGPw/main.cpp b/plugins/CryptoPP/src/PGPw/main.cpp new file mode 100644 index 0000000000..8427046a16 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/main.cpp @@ -0,0 +1,584 @@ +#include "commonheaders.h"
+
+// pgpsdk.lib pgpsdknl.lib pgpsdkui.lib libcmt.lib
+// /delayload:pgpsdk.dll,pgpsdknl.dll,pgpsdkui.dll
+
+PGPContextRef pgpContext;
+#if (PGP_WIN32 < 0x700)
+PGPKeySetRef pgpKeyDB = 0;
+#else
+PGPKeyDBRef pgpKeyDB = 0;
+#endif
+LPSTR pszPassphrase = 0;
+LPSTR pgpErrMsg = 0;
+#define pgpErrMsgLen 512
+UINT pgpVer;
+
+
+void ClearPGPError()
+{
+ *pgpErrMsg = '\0';
+}
+
+
+bool CheckPGPError(PGPError err)
+{
+ if (IsPGPError(err)) {
+ PGPSize ErrMsgLen = pgpErrMsgLen;
+ PGPGetErrorString(err, ErrMsgLen, pgpErrMsg);
+ return 1;
+ }
+ else {
+ *pgpErrMsg = '\0';
+ return 0;
+ }
+}
+
+#define _pgp_memcpy memmove
+/*
+void _pgp_memcpy(LPSTR dst, LPSTR src, UINT size)
+{
+ for(UINT i=0;i<size;i++)
+ dst[i]=src[i];
+}
+*/
+
+int __cdecl _pgp_init()
+{
+ if (!pgpErrMsg)
+ pgpErrMsg = (LPSTR) LocalAlloc(LPTR,pgpErrMsgLen);
+
+ pgpVer = 0;
+
+ __try {
+#if (PGP_WIN32 < 0x700)
+ if (CheckPGPError(PGPsdkInit()) || CheckPGPError(PGPsdkUILibInit())) return 0;
+ PGPNewContext(kPGPsdkAPIVersion, &pgpContext);
+#else
+ if (CheckPGPError(PGPsdkInit(0)) || CheckPGPError(PGPsdkUILibInit(0))) return 0;
+ PGPNewContext(kPGPsdk20APIVersion, &pgpContext);
+#endif
+ }
+ __except ( EXCEPTION_EXECUTE_HANDLER ) {
+ return 0;
+ }
+
+#if (PGP_WIN32 < 0x700)
+ PGPGetSDKVersion(&pgpVer);
+ int minor = (pgpVer & 0x000FF000 ) >> 12;
+ switch(PGPMajorVersion(pgpVer)) {
+ case 2:
+ pgpVer = 1<<24 | ((minor+1)<<16) | (PGPRevVersion(pgpVer)<<8);
+ break;
+ case 3:
+ pgpVer = 1<<24 | ((minor+5)<<16) | (PGPRevVersion(pgpVer)<<8);
+ break;
+ default:
+ pgpVer = 1<<24 | (minor<<16) | (PGPRevVersion(pgpVer)<<8);
+ break;
+ }
+#else
+ pgpVer = PGPGetPGPsdkVersion();
+#endif
+
+ return 1;
+}
+
+
+int __cdecl _pgp_done()
+{
+ pgpVer = 0;
+ __try {
+ if(pgpErrMsg) LocalFree(pgpErrMsg);
+ if (pszPassphrase) PGPFreeData(pszPassphrase);
+#if (PGP_WIN32 < 0x700)
+ if (pgpKeyDB) PGPFreeKeySet(pgpKeyDB);
+#else
+ if (pgpKeyDB) PGPFreeKeyDB(pgpKeyDB);
+#endif
+ PGPFreeContext(pgpContext);
+ PGPsdkUILibCleanup();
+ PGPsdkCleanup();
+ pszPassphrase = pgpErrMsg = 0;
+ pgpKeyDB = 0;
+ pgpContext = 0;
+ }
+ __except ( EXCEPTION_EXECUTE_HANDLER ) {
+ return 0;
+ }
+ return 1;
+}
+
+
+int __cdecl _pgp_open_keyrings(LPSTR PubRingPath, LPSTR SecRingPath)
+{
+ _pgp_close_keyrings();
+
+#if (PGP_WIN32 < 0x700)
+ PGPError err = PGPOpenDefaultKeyRings(pgpContext, kPGPKeyRingOpenFlags_None, &pgpKeyDB);
+#else
+ if ((!PubRingPath || !*PubRingPath) && !ShowSelectKeyringsDlg(0,PubRingPath,SecRingPath)) {
+ return 0;
+ }
+
+ PGPFileSpecRef PubKeyRing, SecKeyRing;
+ PGPNewFileSpecFromFullPath(pgpContext, PubRingPath, &PubKeyRing);
+ PGPNewFileSpecFromFullPath(pgpContext, SecRingPath, &SecKeyRing);
+
+ PGPError err = PGPOpenKeyDBFile(pgpContext, kPGPOpenKeyDBFileOptions_None, PubKeyRing, SecKeyRing, &pgpKeyDB);
+ PGPFreeFileSpec(SecKeyRing);
+ PGPFreeFileSpec(PubKeyRing);
+#endif
+ if (CheckPGPError(err)) {
+ return 0;
+ }
+ return 1;
+}
+
+
+int __cdecl _pgp_close_keyrings()
+{
+#if (PGP_WIN32 < 0x700)
+ if (pgpKeyDB) {
+ PGPFreeKeySet(pgpKeyDB);
+ pgpKeyDB = 0;
+ }
+#else
+ if (pgpKeyDB) {
+ PGPFreeKeyDB(pgpKeyDB);
+ pgpKeyDB = 0;
+ }
+#endif
+ return 1;
+}
+
+
+int __cdecl _pgp_get_version()
+{
+ return pgpVer;
+}
+
+
+LPSTR __cdecl _pgp_get_error()
+{
+ return pgpErrMsg;
+}
+
+
+LPSTR __cdecl _pgp_encrypt_keydb(LPCSTR szPlainMsg, PVOID pgpKeyID)
+{
+ PGPKeyID *RemoteKeyID = (PGPKeyID *) pgpKeyID;
+ LPSTR szEncMsg = 0;
+ DWORD dwEncMsgLen;
+
+ ClearPGPError();
+ if (!pgpKeyDB)
+ return 0;
+
+#if (PGP_WIN32 < 0x700)
+ PGPFilterRef IDFilter;
+ PGPNewKeyIDFilter(pgpContext, RemoteKeyID, &IDFilter);
+
+ PGPKeySetRef PublicKey;
+ PGPFilterKeySet(pgpKeyDB, IDFilter, &PublicKey);
+#else
+ PGPKeyDBObjRef PublicKey;
+ PGPFindKeyByKeyID(pgpKeyDB, RemoteKeyID, &PublicKey);
+#endif
+
+ PGPError err = PGPEncode(pgpContext,
+ PGPOInputBuffer(pgpContext, szPlainMsg, lstrlen(szPlainMsg)),
+ PGPOArmorOutput(pgpContext, TRUE),
+ PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szEncMsg, 16384, (PGPUInt32 *)&dwEncMsgLen),
+#if (PGP_WIN32 < 0x700)
+ PGPOEncryptToKeySet(pgpContext, PublicKey),
+#else
+ PGPOEncryptToKeyDBObj(pgpContext, PublicKey),
+#endif
+ PGPOVersionString(pgpContext, szVersionStr),
+ PGPOLastOption(pgpContext));
+
+#if (PGP_WIN32 < 0x700)
+ PGPFreeKeySet(PublicKey);
+ PGPFreeFilter(IDFilter);
+#endif
+
+ if (CheckPGPError(err))
+ return 0;
+
+ LPSTR szMsg = (LPSTR) LocalAlloc(LPTR,dwEncMsgLen+1);
+ _pgp_memcpy(szMsg, szEncMsg, dwEncMsgLen);
+ szMsg[dwEncMsgLen] = 0;
+ PGPFreeData((LPVOID)szEncMsg);
+
+ return szMsg;
+}
+
+
+LPSTR __cdecl _pgp_decrypt_keydb(LPCSTR szEncMsg)
+{
+ LPSTR szPlainMsg = 0;
+ DWORD dwPlainMsgLen;
+
+ ClearPGPError();
+ if (!pgpKeyDB)
+ return 0;
+
+ int iTry = 0;
+
+ do {
+ if (!pszPassphrase &&
+ PGPPassphraseDialog(pgpContext,
+ PGPOUIOutputPassphrase(pgpContext, &pszPassphrase),
+ PGPOLastOption(pgpContext)) == kPGPError_UserAbort) {
+ iTry = 3;
+ break;
+ }
+
+ PGPError err = PGPDecode(pgpContext,
+ PGPOInputBuffer(pgpContext, szEncMsg, lstrlen(szEncMsg)),
+ PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szPlainMsg, 16384, (PGPUInt32 *)&dwPlainMsgLen),
+#if (PGP_WIN32 < 0x700)
+ PGPOKeySetRef(pgpContext, pgpKeyDB),
+#else
+ PGPOKeyDBRef(pgpContext, pgpKeyDB),
+#endif
+ PGPOPassphrase(pgpContext, pszPassphrase),
+ PGPOLastOption(pgpContext));
+
+ if (CheckPGPError(err))
+ iTry = 3;
+ else
+ if (!dwPlainMsgLen) {
+ PGPFreeData(pszPassphrase);
+ pszPassphrase = 0;
+ iTry++;
+ }
+
+ } while(!dwPlainMsgLen && iTry<3);
+
+ if(iTry == 3) return 0;
+
+ LPSTR szMsg = (LPSTR) LocalAlloc(LPTR,dwPlainMsgLen+1);
+ _pgp_memcpy(szMsg, szPlainMsg, dwPlainMsgLen);
+ szMsg[dwPlainMsgLen] = 0;
+ PGPFreeData((LPVOID)szPlainMsg);
+
+ return szMsg;
+}
+
+
+#if (PGP_WIN32 < 0x700)
+PGPError _pgp_import_key(PGPKeySetRef *keySet, LPCSTR pgpKey)
+{
+ return PGPImportKeySet( pgpContext,
+ keySet,
+ PGPOInputBuffer( pgpContext,
+ pgpKey,
+ lstrlen(pgpKey) ),
+ PGPOLastOption( pgpContext ) );
+}
+#else
+PGPError _pgp_import_key(PGPKeyDBRef *keyDB, LPCSTR pgpKey)
+{
+ return PGPImport( pgpContext,
+ keyDB,
+ PGPOInputBuffer( pgpContext,
+ pgpKey,
+ lstrlen(pgpKey) ),
+ PGPOLastOption( pgpContext ) );
+}
+#endif
+
+/*
+int __cdecl _pgp_check_key(LPCSTR pgpKey)
+{
+#if (PGP_WIN32 < 0x700)
+ PGPKeySetRef PrivateKey;
+ if (CheckPGPError(_pgp_import_key(&PrivateKey,pgpKey)))
+ return 0;
+ PGPFreeKeySet(PrivateKey);
+#else
+ PGPKeyDBRef PrivateKey;
+ if (CheckPGPError(_pgp_import_key(&PrivateKey,pgpKey)))
+ return 0;
+ PGPFreeKeyDB(PrivateKey);
+#endif
+ return 1;
+}
+*/
+
+LPSTR __cdecl _pgp_encrypt_key(LPCSTR szPlainMsg, LPCSTR pgpKey)
+{
+ LPSTR szEncMsg = 0;
+ DWORD dwEncMsgLen;
+
+ PGPUInt32 dwKeys;
+#if (PGP_WIN32 < 0x700)
+ PGPKeySetRef PublicKey;
+ if (CheckPGPError(_pgp_import_key(&PublicKey,pgpKey)))
+ return 0;
+ PGPCountKeys(PublicKey, &dwKeys);
+#else
+ PGPKeyDBRef PublicKeyDB;
+ if (CheckPGPError(_pgp_import_key(&PublicKeyDB,pgpKey)))
+ return 0;
+
+ PGPKeyIterRef KeyIterRef;
+ PGPNewKeyIterFromKeyDB(PublicKeyDB, &KeyIterRef);
+
+ PGPKeyDBObjRef PublicKey;
+ PGPKeyIterNextKeyDBObj(KeyIterRef, kPGPKeyDBObjType_Key, &PublicKey);
+
+ PGPCountKeysInKeyDB(PublicKeyDB, &dwKeys);
+#endif
+ if(dwKeys==0) {
+#if (PGP_WIN32 < 0x700)
+ PGPFreeKeySet(PublicKey);
+#else
+ PGPFreeKeyIter(KeyIterRef);
+ PGPFreeKeyDB(PublicKeyDB);
+#endif
+ return 0;
+ }
+
+ PGPError err = PGPEncode(pgpContext,
+ PGPOInputBuffer(pgpContext, szPlainMsg, lstrlen(szPlainMsg)),
+ PGPOArmorOutput(pgpContext, TRUE),
+ PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szEncMsg, 16384, (PGPUInt32 *)&dwEncMsgLen),
+#if (PGP_WIN32 < 0x700)
+ PGPOEncryptToKeySet(pgpContext, PublicKey),
+#else
+ PGPOEncryptToKeyDBObj(pgpContext, PublicKey),
+#endif
+ PGPOVersionString(pgpContext, szVersionStr),
+ PGPOLastOption(pgpContext));
+
+#if (PGP_WIN32 < 0x700)
+ PGPFreeKeySet(PublicKey);
+#else
+ PGPFreeKeyIter(KeyIterRef);
+ PGPFreeKeyDB(PublicKeyDB);
+#endif
+
+ if (CheckPGPError(err))
+ return 0;
+
+ LPSTR szMsg = (LPSTR) LocalAlloc(LPTR,dwEncMsgLen+1);
+ _pgp_memcpy(szMsg, szEncMsg, dwEncMsgLen);
+ szMsg[dwEncMsgLen] = 0;
+ PGPFreeData((LPVOID)szEncMsg);
+
+ return szMsg;
+}
+
+
+LPSTR __cdecl _pgp_decrypt_key(LPCSTR szEncMsg, LPCSTR pgpKey)
+{
+ LPSTR szPlainMsg = 0;
+ DWORD dwPlainMsgLen;
+
+ PGPUInt32 dwKeys;
+#if (PGP_WIN32 < 0x700)
+ PGPKeySetRef PrivateKeyDB;
+ if (CheckPGPError(_pgp_import_key(&PrivateKeyDB,pgpKey)))
+ return 0;
+ PGPCountKeys(PrivateKeyDB, &dwKeys);
+#else
+ PGPKeyDBRef PrivateKeyDB;
+ if (CheckPGPError(_pgp_import_key(&PrivateKeyDB,pgpKey)))
+ return 0;
+ PGPCountKeysInKeyDB(PrivateKeyDB, &dwKeys);
+#endif
+ if(dwKeys==0) {
+#if (PGP_WIN32 < 0x700)
+ PGPFreeKeySet(PrivateKeyDB);
+#else
+ PGPFreeKeyDB(PrivateKeyDB);
+#endif
+ return 0;
+ }
+
+ int iTry = 0;
+
+ do {
+ if (!pszPassphrase &&
+ PGPPassphraseDialog(pgpContext,
+ PGPOUIOutputPassphrase(pgpContext, &pszPassphrase),
+ PGPOLastOption(pgpContext)) == kPGPError_UserAbort) {
+ iTry = 3;
+ break;
+ }
+
+/*
+#if (PGP_WIN32 < 0x700)
+ PGPKeyListRef PrivateKeyList;
+ PGPOrderKeySet(PrivateKeyDB, kPGPKeyIDOrdering, &PrivateKeyList);
+
+ PGPKeyIterRef KeyIterRef;
+ PGPNewKeyIter(PrivateKeyList, &KeyIterRef);
+
+ PGPKeyRef PrivateKey;
+ for(int i=0;i<dwKeys;i++) {
+ PGPKeyIterNext(KeyIterRef, &PrivateKey);
+ PGPOPassphraseIsValid(PrivateKey,
+ PGPOPassphrase(pgpContext, pszPassphrase),
+ PGPOLastOption(pgpContext));
+ }
+
+ PGPFreeKeyList(PrivateKeyList);
+ PGPFreeKeyIter(KeyIterRef);
+#else
+ PGPKeyIterRef KeyIterRef;
+ PGPNewKeyIterFromKeyDB(PrivateKeyDB, &KeyIterRef);
+
+ PGPKeyDBObjRef KeyDBObjRef;
+ for(int i=0;i<dwKeys;i++) {
+ PGPKeyIterNextKeyDBObj(KeyIterRef, kPGPKeyDBObjType_Key, &KeyDBObjRef);
+ PGPOPassphraseIsValid(PrivateKey,
+ PGPOPassphrase(pgpContext, pszPassphrase),
+ PGPOLastOption(pgpContext));
+ }
+
+ PGPFreeKeyIter(KeyIterRef);
+#endif
+*/
+ PGPError err = PGPDecode(pgpContext,
+ PGPOInputBuffer(pgpContext, szEncMsg, lstrlen(szEncMsg)),
+ PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szPlainMsg, 16384, (PGPUInt32 *)&dwPlainMsgLen),
+#if (PGP_WIN32 < 0x700)
+ PGPOKeySetRef(pgpContext, PrivateKeyDB),
+#else
+ PGPOKeyDBRef(pgpContext, PrivateKeyDB),
+#endif
+ PGPOPassphrase(pgpContext, pszPassphrase),
+ PGPOLastOption(pgpContext));
+
+ if (CheckPGPError(err))
+ iTry = 3;
+ else
+ if (!dwPlainMsgLen) {
+ PGPFreeData(pszPassphrase);
+ pszPassphrase = 0;
+ iTry++;
+ }
+
+ } while(!dwPlainMsgLen && iTry<3);
+
+#if (PGP_WIN32 < 0x700)
+ PGPFreeKeySet(PrivateKeyDB);
+#else
+ PGPFreeKeyDB(PrivateKeyDB);
+#endif
+
+ if(iTry == 3) return 0;
+
+ LPSTR szMsg = (LPSTR) LocalAlloc(LPTR,dwPlainMsgLen+1);
+ _pgp_memcpy(szMsg, szPlainMsg, dwPlainMsgLen);
+ szMsg[dwPlainMsgLen] = 0;
+ PGPFreeData((LPVOID)szPlainMsg);
+
+ return szMsg;
+}
+
+
+int __cdecl _pgp_size_keyid()
+{
+ return sizeof(PGPKeyID);
+}
+
+
+PVOID __cdecl _pgp_select_keyid(HWND hDlg,LPSTR szKeyID)
+{
+#if (PGP_WIN32 < 0x700)
+ PGPKeySetRef ContactKeyDB;
+#else
+ PGPKeyDBRef ContactKeyDB;
+#endif
+ PGPError err;
+ err = PGPRecipientDialog(pgpContext, pgpKeyDB, TRUE, &ContactKeyDB,
+ PGPOUIParentWindowHandle(pgpContext, hDlg),
+ PGPOUIWindowTitle(pgpContext, "Select Contact's Key"),
+ PGPOLastOption(pgpContext));
+ if (err == kPGPError_UserAbort)
+ return 0;
+
+ PGPUInt32 dwKeys;
+#if (PGP_WIN32 < 0x700)
+ PGPCountKeys(ContactKeyDB, &dwKeys);
+#else
+ PGPCountKeysInKeyDB(ContactKeyDB, &dwKeys);
+#endif
+ if (!dwKeys) {
+ return 0;
+ } else if (dwKeys > 1)
+ MessageBox(hDlg, "You selected more than one key. Only the first key will be used.", szModuleName, MB_ICONINFORMATION);
+
+ static PGPKeyID KeyID;
+
+#if (PGP_WIN32 < 0x700)
+ PGPKeyListRef ContactKeyList;
+ PGPOrderKeySet(ContactKeyDB, kPGPKeyIDOrdering, &ContactKeyList);
+
+ PGPKeyIterRef KeyIterRef;
+ PGPNewKeyIter(ContactKeyList, &KeyIterRef);
+
+ PGPKeyRef ContactKey;
+ PGPKeyIterNext(KeyIterRef, &ContactKey);
+
+ PGPGetKeyIDFromKey(ContactKey, &KeyID);
+ PGPGetKeyIDString(&KeyID, kPGPKeyIDString_Abbreviated, szKeyID);
+
+ PGPFreeKeyList(ContactKeyList);
+ PGPFreeKeyIter(KeyIterRef);
+ PGPFreeKeySet(ContactKeyDB);
+#else
+ PGPKeyIterRef KeyIterRef;
+ PGPNewKeyIterFromKeyDB(ContactKeyDB, &KeyIterRef);
+
+ PGPKeyDBObjRef KeyDBObjRef;
+ PGPKeyIterNextKeyDBObj(KeyIterRef, kPGPKeyDBObjType_Key, &KeyDBObjRef);
+
+ PGPSize dwFilled;
+ PGPGetKeyDBObjDataProperty(KeyDBObjRef, kPGPKeyProperty_KeyID, &KeyID, sizeof(PGPKeyID), &dwFilled);
+ PGPGetKeyIDString(&KeyID, kPGPKeyIDString_Abbreviated, szKeyID);
+
+ PGPFreeKeyIter(KeyIterRef);
+ PGPFreeKeyDB(ContactKeyDB);
+#endif
+
+ return (PVOID)&KeyID;
+}
+
+
+#if (PGP_WIN32 >= 0x700)
+BOOL ShowSelectKeyringsDlg(HWND hParent, LPSTR PubRingPath, LPSTR SecRingPath)
+{
+ // set keyring paths
+ OPENFILENAME ofn={0};
+ ofn.lStructSize = sizeof(ofn);
+ ofn.hwndOwner = hParent;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
+
+ ofn.lpstrFile = PubRingPath;
+ ofn.lpstrFilter = "Public key rings (pubring.pkr)\0pubring.pkr\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Open Public Keyring";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ ofn.lpstrFile = SecRingPath;
+ ofn.lpstrFilter = "Secret key rings (secring.skr)\0secring.skr\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Open Secret Keyring";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ return TRUE;
+}
+#endif
+
+
+// dllmain
+BOOL WINAPI dllmain(HINSTANCE hInst, DWORD dwReason, LPVOID) {
+ g_hInst = hInst;
+ return TRUE;
+}
+
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpBase.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpBase.h new file mode 100644 index 0000000000..7e460c800a --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpBase.h @@ -0,0 +1,270 @@ +/*____________________________________________________________________________
+ pgpBase.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ This file deals with system dependencies to derive our very basic data
+ types. It should not contain any higher level types.
+
+ $Id: pgpBase.h,v 1.27.16.1 1999/08/04 18:35:43 sluu Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpBase_h /* [ */
+#define Included_pgpBase_h
+
+#include "pgpPFLConfig.h"
+
+
+#include <stddef.h>
+
+
+
+#if !( defined(PGP_MACINTOSH) || defined(PGP_UNIX) || defined(PGP_WIN32) )
+#error one of {PGP_MACINTOSH, PGP_UNIX, PGP_WIN32} must be defined
+#endif
+
+#if PGP_MACINTOSH
+#include <stddef.h>
+#if __MWERKS__ && ! defined( __dest_os )
+ #include <ansi_parms.h>
+ #define __dest_os __mac_os
+#endif
+#else
+ /* aCC bars on <sys/time.h> if this file is not included first */
+ #if PGP_COMPILER_HPUX
+ #include <sys/sigevent.h>
+ #endif /* PGP_COMPILER_HPUX */
+ #include <sys/types.h>
+#endif
+
+#if PGP_WIN32
+#include <stddef.h> /* For size_t */
+#endif
+
+#if ! NO_LIMITS_H
+#include <limits.h>
+#endif
+
+
+/*____________________________________________________________________________
+ PGP basic types
+____________________________________________________________________________*/
+
+typedef unsigned char PGPBoolean; /* can be TRUE or FALSE */
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+/* PGPUInt8, PGPInt8 */
+#if UCHAR_MAX == 0xff
+
+typedef unsigned char PGPUInt8;
+typedef signed char PGPInt8;
+#define MAX_PGPUInt8 UCHAR_MAX
+#define MAX_PGPInt8 SCHAR_MAX
+
+#else
+#error This machine has no 8-bit type
+#endif
+
+
+/* PGPUInt16, PGPInt16 */
+#if UINT_MAX == 0xffff
+
+typedef unsigned int PGPUInt16;
+typedef int PGPInt16;
+#define MAX_PGPUInt16 UINT_MAX
+#define MAX_PGPInt16 INT_MAX
+
+#elif USHRT_MAX == 0xffff
+
+typedef unsigned short PGPUInt16;
+typedef short PGPInt16;
+#define MAX_PGPUInt16 USHRT_MAX
+#define MAX_PGPInt16 SHRT_MAX
+
+#else
+#error This machine has no 16-bit type
+#endif
+
+
+/* PGPUInt32, PGPInt32 */
+#if UINT_MAX == 0xfffffffful
+
+typedef unsigned int PGPUInt32;
+typedef int PGPInt32;
+#define MAX_PGPUInt32 UINT_MAX
+#define MAX_PGPInt32 INT_MAX
+
+#elif ULONG_MAX == 0xfffffffful
+
+typedef unsigned long PGPUInt32;
+typedef long PGPInt32;
+#define MAX_PGPUInt32 ULONG_MAX
+#define MAX_PGPInt32 LONG_MAX
+
+#elif USHRT_MAX == 0xfffffffful
+
+typedef unsigned short PGPUInt32;
+typedef short PGPInt32;
+#define MAX_PGPUInt32 USHRT_MAX
+#define MAX_PGPInt32 SHRT_MAX
+
+#else
+#error This machine has no 32-bit type
+#endif
+
+
+/*____________________________________________________________________________
+ PGPUInt64, PGPInt64
+
+ Find a 64-bit data type, if possible.
+ The conditions here are more complicated to avoid using numbers that
+ will choke lesser preprocessors (like 0xffffffffffffffff) unless
+ we're reasonably certain that they'll be acceptable.
+
+ Some *preprocessors* choke on constants that long even if the
+ compiler can accept them, so it doesn't work reliably to test values.
+ So cross our fingers and hope that it's a 64-bit type.
+
+ GCC uses ULONG_LONG_MAX. Solaris uses ULLONG_MAX.
+ IRIX uses ULONGLONG_MAX. Are there any other names for this?
+____________________________________________________________________________*/
+#if ULONG_MAX > 0xfffffffful
+#if ULONG_MAX == 0xfffffffffffffffful
+
+typedef ulong PGPUInt64;
+typedef long PGPInt64;
+#define PGP_HAVE64 1
+
+#endif
+#endif
+
+
+#ifndef PGP_HAVE64
+
+#if defined(ULONG_LONG_MAX) || defined (ULLONG_MAX) || defined(ULONGLONG_MAX)
+typedef unsigned long long PGPUInt64;
+typedef long long PGPInt64;
+#define PGP_HAVE64 1
+
+#endif
+#endif
+
+
+#ifndef PGP_HAVE64
+#if defined(__MWERKS__)
+#if __option( longlong )
+
+typedef unsigned long long PGPUInt64;
+typedef long long PGPInt64;
+#define PGP_HAVE64 1
+
+#endif
+#endif
+#endif
+
+#if PGP_HAVE64
+/* too painful to test all the variants above, so just do it this way */
+#define MAX_PGPUInt64 ((PGPUInt64)0xfffffffffffffffful)
+#define MAX_PGPInt64 ((PGPInt64)0x7fffffffffffffff)
+#endif
+
+
+#if INT_MAX == 0x7FFFFFFFL
+#define PGPENUM_TYPEDEF( enumName, typeName ) typedef enum enumName typeName
+#else
+#define PGPENUM_TYPEDEF( enumName, typeName ) typedef PGPInt32 typeName
+#endif
+#define kPGPEnumMaxValue INT_MAX
+
+#define PGP_ENUM_FORCE( enumName ) \
+ k ## enumName ## force = kPGPEnumMaxValue
+
+
+typedef PGPUInt8 PGPByte;
+
+typedef PGPInt32 PGPError;
+
+/* a simple value sufficient to hold any numeric or pointer type */
+typedef void * PGPUserValue;
+
+/* A PGPSize refers to in memory sizes. Use PGPFileOffset for file offsets */
+#if PGP_UNIX_HPUX
+/* HPUX has conflicting types for size_t. This forces a PGPSize to
+ * always be the same type. */
+typedef unsigned long PGPSize;
+#else
+typedef size_t PGPSize;
+#endif
+
+#define MAX_PGPSize ( ~(PGPSize)0 )
+
+/* An offset or size of a file */
+#if PGP_UNIX
+typedef off_t PGPFileOffset;
+#else
+#if PGP_HAVE64
+typedef PGPInt64 PGPFileOffset;
+#else
+typedef PGPInt32 PGPFileOffset;
+#endif
+#endif
+
+typedef PGPUInt32 PGPFlags;
+typedef PGPUInt32 PGPTime;
+typedef PGPUInt32 PGPTimeInterval; /* In milliseconds */
+
+typedef struct PGPVersion
+{
+ PGPUInt16 majorVersion;
+ PGPUInt16 minorVersion;
+
+} PGPVersion;
+
+/*____________________________________________________________________________
+ These macros should surround all C declarations in public
+ header files which define function or data symbols.
+____________________________________________________________________________*/
+
+#ifdef __cplusplus /* [ */
+
+#define PGP_BEGIN_C_DECLARATIONS extern "C" {
+#define PGP_END_C_DECLARATIONS }
+
+#else /* ] __cplusplus [ */
+
+#define PGP_BEGIN_C_DECLARATIONS
+#define PGP_END_C_DECLARATIONS
+
+#endif /* ] __cplusplus */
+
+
+
+
+#ifndef pgpMin
+#define pgpMin(x,y) (((x)<(y)) ? (x) : (y))
+#endif
+
+#ifndef pgpMax
+#define pgpMax(x,y) (((x)>(y)) ? (x) : (y))
+#endif
+
+#ifndef PGP_DEPRECATED
+#define PGP_DEPRECATED 1
+#endif
+
+#endif /* ] Included_pgpBase_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpBigNum.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpBigNum.h new file mode 100644 index 0000000000..81c6b17429 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpBigNum.h @@ -0,0 +1,208 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpBigNum.h,v 1.9 1999/03/10 02:47:07 heller Exp $
+____________________________________________________________________________*/
+
+
+#ifndef Included_pgpBigNum_h
+#define Included_pgpBigNum_h
+
+#include "pgpBase.h"
+
+#include "pgpUtilities.h"
+
+#include "pgpMemoryMgr.h"
+
+PGP_BEGIN_C_DECLARATIONS
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+typedef struct PGPBigNum * PGPBigNumRef;
+#define kPGPInvalidBigNumRef ( (PGPBigNumRef)NULL )
+
+
+/* Creates a new bignum, secure, or plain s*/
+PGPError PGPNewBigNum( PGPMemoryMgrRef mgr,
+ PGPBoolean secure, PGPBigNumRef *newBN );
+
+/* destoys the bignum and all memory it uses */
+PGPError PGPFreeBigNum( PGPBigNumRef bn );
+
+
+/* Create a new big num with same value as src */
+PGPError PGPCopyBigNum( PGPBigNumRef src, PGPBigNumRef * dest );
+
+/* Make existing bignum dest have same value as source */
+PGPError PGPAssignBigNum( PGPBigNumRef src, PGPBigNumRef dest );
+
+
+/* Swap two BigNums. Very fast. */
+PGPError PGPSwapBigNum( PGPBigNumRef a, PGPBigNumRef b);
+
+
+/*
+ * Move bytes between the given buffer and the given BigNum encoded in
+ * base 256. I.e. after either of these, the buffer will be equal to
+ * (bn / 256^lsbyte) % 256^len. The difference is which is altered to
+ * match the other!
+ */
+PGPError PGPBigNumExtractBigEndianBytes( PGPBigNumRef bn,
+ PGPByte *dest, PGPUInt32 lsbyte, PGPUInt32 len );
+
+PGPError PGPBigNumInsertBigEndianBytes(PGPBigNumRef bn,
+ PGPByte const *src, PGPUInt32 lsbyte, PGPUInt32 len );
+
+/* The same, but the buffer is little-endian. */
+PGPError PGPBigNumExtractLittleEndianBytes( PGPBigNumRef bn,
+ PGPByte *dest, PGPUInt32 lsbyte, PGPUInt32 len );
+
+PGPError PGPBigNumInsertLittleEndianBytes(PGPBigNumRef bn,
+ PGPByte const *src, PGPUInt32 lsbyte, PGPUInt32 len );
+
+/* Return the least-significant bits (at least 16) of the BigNum */
+PGPUInt16 PGPBigNumGetLSWord( PGPBigNumRef bn );
+
+/*
+ * Return the number of significant bits in the BigNum.
+ * 0 or 1+floor(log2(src))
+ */
+PGPUInt32 PGPBigNumGetSignificantBits( PGPBigNumRef bn );
+
+/*
+ * Adds two bignums into dest. Faster if dest is same as lhs or rhs.
+ */
+PGPError PGPBigNumAdd( PGPBigNumRef lhs,
+ PGPBigNumRef rhs, PGPBigNumRef dest );
+
+/*
+ * lhs-rhs. dest and src may be the same, but bnSetQ(dest, 0) is faster.
+ * if dest < src, returns error and dest is undefined.
+ */
+PGPError PGPBigNumSubtract( PGPBigNumRef lhs,
+ PGPBigNumRef rhs, PGPBigNumRef dest,
+ PGPBoolean *underflow );
+
+
+/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmpQ(a, b) <=> 0 */
+PGPInt32 PGPBigNumCompareQ( PGPBigNumRef bn, PGPUInt16 sm );
+
+/* dest = src, where 0 <= src < 2^16. */
+PGPError PGPBigNumSetQ( PGPBigNumRef dest, PGPUInt16 sm );
+
+/* dest = bn + sm, where 0 <= sm < 2^16 */
+PGPError PGPBigNumAddQ( PGPBigNumRef bn, PGPUInt16 sm,
+ PGPBigNumRef dest);
+
+/* dest = bn + sm, where 0 <= sm < 2^16 */
+PGPError PGPBigNumSubtractQ( PGPBigNumRef bn, PGPUInt16 sm,
+ PGPBigNumRef dest, PGPBoolean *underflow);
+
+/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmp(a, b) <=> 0 */
+PGPInt32 PGPBigNumCompare( PGPBigNumRef lhs, PGPBigNumRef rhs);
+
+/* dest = src * src. dest may be the same as src, but it costs time. */
+PGPError PGPBigNumSquare( PGPBigNumRef src, PGPBigNumRef dest);
+
+/* dest = a * b. dest may be the same as a or b, but it costs time. */
+PGPError PGPBigNumMultiply( PGPBigNumRef lhs, PGPBigNumRef rhs,
+ PGPBigNumRef dest);
+
+/* dest = a * b, where 0 <= b < 2^16. dest and a may be the same. */
+PGPError PGPBigNumMultiplyQ( PGPBigNumRef lhs, PGPUInt16 sm,
+ PGPBigNumRef dest);
+
+/*
+ * q = n/d, r = n%d. r may be the same as n, but not d,
+ * and q may not be the same as n or d.
+ * re-entrancy issue: this temporarily modifies d, but restores
+ * it for return.
+ */
+PGPError PGPBigNumDivide( PGPBigNumRef numerator,
+ PGPBigNumRef denominator,
+ PGPBigNumRef quotient,
+ PGPBigNumRef remainder);
+/*
+ * dest = n % d. dest and src may be the same, but not dest and d.
+ * re-entrancy issue: this temporarily modifies d, but restores
+ * it for return.
+ */
+PGPError PGPBigNumMod( PGPBigNumRef numerator,
+ PGPBigNumRef denominator,
+ PGPBigNumRef dest );
+
+/* return src % d, where 0 <= d < 2^16. */
+PGPUInt16 PGPBigNumModQ( PGPBigNumRef numerator,
+ PGPUInt16 denominator );
+
+/* n = n^exp, modulo "mod" "mod" *must* be odd */
+PGPError PGPBigNumExpMod(
+ PGPBigNumRef n,
+ PGPBigNumRef exponent,
+ PGPBigNumRef mod,
+ PGPBigNumRef dest );
+
+/*
+ * dest = n1^e1 * n2^e2, modulo "mod". "mod" *must* be odd.
+ * dest may be the same as n1 or n2.
+ */
+PGPError PGPBigNumDoubleExpMod(
+ PGPBigNumRef n1,
+ PGPBigNumRef exponent1,
+ PGPBigNumRef n2,
+ PGPBigNumRef exponent2,
+ PGPBigNumRef mod,
+ PGPBigNumRef dest );
+
+/* dest = 2^exp, modulo "mod" "mod" *must* be odd */
+PGPError PGPBigNumTwoExpMod(
+ PGPBigNumRef exponent,
+ PGPBigNumRef mod,
+ PGPBigNumRef dest );
+
+/* dest = gcd(a, b). The inputs may overlap arbitrarily. */
+PGPError PGPBigNumGCD( PGPBigNumRef a, PGPBigNumRef b,
+ PGPBigNumRef dest );
+
+/* dest = src^-1, modulo "mod". dest may be the same as src. */
+PGPError PGPBigNumInv( PGPBigNumRef src,
+ PGPBigNumRef mod,
+ PGPBigNumRef dest );
+
+
+/* Shift dest left "amt" places */
+PGPError PGPBigNumLeftShift( PGPBigNumRef dest, PGPUInt32 amt );
+
+/* Shift dest right "amt" places, discarding low-order bits */
+PGPError PGPBigNumRightShift( PGPBigNumRef dest, PGPUInt32 amt );
+
+/* right shift all low order 0-bits, return number of bits shifted */
+PGPUInt16 PGPBigNumMakeOdd( PGPBigNumRef dest );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+
+PGP_END_C_DECLARATIONS
+
+#endif /* Included_pgpBigNum_h */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpCBC.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpCBC.h new file mode 100644 index 0000000000..9e3ea0382a --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpCBC.h @@ -0,0 +1,93 @@ +/*____________________________________________________________________________
+ pgpCBC.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpCBC.h,v 1.5 1999/03/10 02:47:09 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpCBC_h /* [ */
+#define Included_pgpCBC_h
+
+#include "pgpSymmetricCipher.h"
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/*____________________________________________________________________________
+ A CBC context requires use of a symmetric cipher which has been created
+ and whose key has been set. An error will be returned if this is not
+ the case.
+
+ After the call, the CBCContextRef "owns" the
+ symmetric ref and will dispose of it properly (even if an error
+ occurs). The caller should no longer reference it.
+____________________________________________________________________________*/
+PGPError PGPNewCBCContext( PGPSymmetricCipherContextRef ref,
+ PGPCBCContextRef *outRef );
+
+
+/*____________________________________________________________________________
+ Disposal clears all data in memory before releasing it.
+____________________________________________________________________________*/
+PGPError PGPFreeCBCContext( PGPCBCContextRef ref );
+
+
+/*____________________________________________________________________________
+ Make an exact copy, including current state. Original is not changed.
+____________________________________________________________________________*/
+PGPError PGPCopyCBCContext( PGPCBCContextRef ref, PGPCBCContextRef *outRef );
+
+
+
+/*____________________________________________________________________________
+ IV size is implicit (same size as the symmetric cipher block size).
+ IV is *copied*.
+ Caller may want to destroy the original after passing it in.
+____________________________________________________________________________*/
+PGPError PGPInitCBC( PGPCBCContextRef ref,
+ const void *key,
+ const void *initializationVector );
+
+
+/*____________________________________________________________________________
+ Call repeatedly to process arbitrary amounts of data. Each call must
+ have bytesIn be a multiple of the cipher block size.
+____________________________________________________________________________*/
+PGPError PGPCBCEncrypt( PGPCBCContextRef ref,
+ const void *in, PGPSize bytesIn, void *out );
+
+PGPError PGPCBCDecrypt( PGPCBCContextRef ref,
+ const void *in, PGPSize bytesIn, void *out );
+
+
+
+/*____________________________________________________________________________
+ Get the symmetric cipher being used for this CBC context.
+ You can use this to determine useful things about the underlying cipher
+ such as its block size.
+____________________________________________________________________________*/
+PGPError PGPCBCGetSymmetricCipher( PGPCBCContextRef ref,
+ PGPSymmetricCipherContextRef *outRef );
+
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpCBC_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpCFB.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpCFB.h new file mode 100644 index 0000000000..54ae8d7e43 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpCFB.h @@ -0,0 +1,127 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpCFB.h,v 1.6 1999/03/10 02:47:11 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpCFB_h /* [ */
+#define Included_pgpCFB_h
+
+#include "pgpSymmetricCipher.h"
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/*____________________________________________________________________________
+ A CFB context requires use of a symmetric cipher which has been created
+ and whose key has been set. An error will be returned if this is not
+ the case.
+
+ After the call, the CFBRef "owns" the symmetric ref and will
+ dispose of it properly (even if an error occurs).
+ The caller should no longer reference it.
+____________________________________________________________________________*/
+PGPError PGPNewCFBContext( PGPSymmetricCipherContextRef ref,
+ PGPUInt16 interleaveFactor,
+ PGPCFBContextRef *outRef );
+
+
+/*____________________________________________________________________________
+ Disposal clears all data in memory before releasing it.
+____________________________________________________________________________*/
+PGPError PGPFreeCFBContext( PGPCFBContextRef ref );
+
+
+/*____________________________________________________________________________
+ Make an exact copy, including current state. Original is not changed.
+____________________________________________________________________________*/
+PGPError PGPCopyCFBContext( PGPCFBContextRef ref,
+ PGPCFBContextRef *outRef );
+
+
+
+/*____________________________________________________________________________
+ IV size is implicit (same size as the symmetric cipher block size).
+ IV is *copied*.
+ Caller may want to destroy the original after passing it in.
+ Calling this implicitly calls PGPResetCFB().
+____________________________________________________________________________*/
+PGPError PGPInitCFB( PGPCFBContextRef ref,
+ const void *key,
+ const void *initializationVector );
+
+
+/*____________________________________________________________________________
+ Call repeatedly to process arbitrary amounts of data.
+____________________________________________________________________________*/
+PGPError PGPCFBEncrypt( PGPCFBContextRef ref,
+ const void *in, PGPSize bytesIn, void *out );
+
+PGPError PGPCFBDecrypt( PGPCFBContextRef ref,
+ const void *in, PGPSize bytesIn, void *out );
+
+
+
+/*____________________________________________________________________________
+ Get the symmetric cipher being used for this CFB context.
+ You can use this to determine useful things about the underlying cipher
+ such as its block size.
+____________________________________________________________________________*/
+PGPError PGPCFBGetSymmetricCipher(
+ PGPCFBContextRef ref,
+ PGPSymmetricCipherContextRef *outRef );
+
+
+
+/*____________________________________________________________________________
+ Reset the feedback mechanism to use whatever we have so far, plus previous
+ bytes for a total of the cipher block size bytes. This effectively
+ changes the cipher block boundary.
+____________________________________________________________________________*/
+PGPError PGPCFBSync( PGPCFBContextRef ref );
+
+
+
+/*____________________________________________________________________________
+ Fetch random bytes from the cipher. Returns the actual number of
+ random bytes obtained.
+____________________________________________________________________________*/
+PGPError PGPCFBGetRandom( PGPCFBContextRef ref,
+ PGPSize requestCount, void *out, PGPSize *outCount);
+
+
+/*____________________________________________________________________________
+ Make more random bytes available using the supplied salt, which must
+ be the same as the symmetric cipher block size.
+____________________________________________________________________________*/
+PGPError PGPCFBRandomCycle( PGPCFBContextRef ref,
+ const void *salt);
+
+
+/*____________________________________________________________________________
+ Make more random bytes available using the supplied salt, which must
+ be the same as the symmetric cipher block size.
+____________________________________________________________________________*/
+PGPError PGPCFBRandomWash( PGPCFBContextRef ref,
+ const void *in, PGPSize bytesIn );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpCFB_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpConfig.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpConfig.h new file mode 100644 index 0000000000..f72f0d4c9b --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpConfig.h @@ -0,0 +1,96 @@ +/*
+ * pgpConfig.h -- Configuration for the PGPsdk. This file contains
+ * the configuration information for the PGPsdk, and it should be
+ * included in all PGPsdk source files.
+ *
+ * $Id: pgpConfig.h,v 1.13 1997/09/30 21:03:13 lloyd Exp $
+ */
+
+/* Define to empty if the compiler does not support 'const' variables. */
+/* #undef const */
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+
+#ifndef Included_pgpConfig_h /* [ */
+#define Included_pgpConfig_h
+
+#include "pgpPFLConfig.h"
+
+
+
+
+
+#ifndef Included_pgpPFLConfig_h /* [ */
+
+#define HAVE_STDARG_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_UNISTD_H 0
+#define HAVE_USHORT 0
+#define HAVE_UINT 0
+#define HAVE_ULONG 0
+#define NO_LIMITS_H 0
+#define NO_POPEN 1
+
+#if defined( _MSC_VER )
+#define PGP_HAVE64 1
+typedef __int64 PGPInt64;
+typedef unsigned __int64 PGPUInt64;
+
+#elif defined( __MWERKS__ )
+
+#define PGP_HAVE64 0
+
+#endif
+
+
+
+#endif /*Included_pgpPFLConfig_h*/ /* ] */
+
+
+/* Checks for various types */
+#define HAVE_UCHAR 0
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Checks for various specific header files */
+#define HAVE_FCNTL_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_SYS_IOCTL_H 0
+#define HAVE_SYS_TIME_H 0
+#define HAVE_SYS_TIMEB_H 1
+#define HAVE_SYS_PARAM_H 0
+
+/* Check if <sys/time.h> is broken and #includes <time.h> wrong */
+#define TIME_WITH_SYS_TIME 0
+
+/* Checks for various functions */
+#define HAVE_GETHRTIME 0
+#define HAVE_CLOCK_GETTIME 0
+#define HAVE_CLOCK_GETRES 0
+#define HAVE_GETTIMEOFDAY 0
+#define HAVE_GETITIMER 0
+#define HAVE_SETITIMER 0
+#define HAVE_FTIME 1
+#define HAVE_MKSTEMP 0
+
+
+#if defined( __MWERKS__ )
+
+#define PGPTTYE /* nothing */
+
+#elif defined( _MSC_VER )
+
+/* Tags for exported functions, needed for dynamic linking on some platforms */
+#define PGPTTYE /* nothing */
+
+#endif
+
+
+
+#endif /* ] Included_pgpConfig_h */
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpEncode.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpEncode.h new file mode 100644 index 0000000000..8b87c1c2f9 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpEncode.h @@ -0,0 +1,301 @@ +/*____________________________________________________________________________
+ pgpEncode.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ This file contains the prototypes for functions which encode/decode files
+ and buffers.
+
+ $Id: pgpEncode.h,v 1.104 1999/05/07 23:47:46 hal Exp $
+____________________________________________________________________________*/
+
+#ifndef Included_pgpEncode_h /* [ */
+#define Included_pgpEncode_h
+
+#include "pgpPubTypes.h"
+#include "pgpTLS.h"
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=mac68k
+#endif
+
+/*
+ * The PGPEvent structure is used to notify clients of the encode API of
+ * various events.
+ */
+
+/* PGP Event types */
+
+enum PGPEventType_
+{
+ kPGPEvent_NullEvent = 0, /* Nothing happened */
+ kPGPEvent_InitialEvent = 1, /* Final event */
+ kPGPEvent_FinalEvent = 2, /* Final event */
+ kPGPEvent_ErrorEvent = 3, /* An error occurred */
+ kPGPEvent_WarningEvent = 4, /* Warning event */
+ kPGPEvent_EntropyEvent = 5, /* More entropy is needed */
+ kPGPEvent_PassphraseEvent = 6, /* A passphrase is needed */
+ kPGPEvent_InsertKeyEvent = 7, /* Smart card must be inserted */
+ kPGPEvent_AnalyzeEvent = 8, /* Initial analysis event,
+ before any output */
+ kPGPEvent_RecipientsEvent = 9, /* Recipient list report,
+ before any output */
+ kPGPEvent_KeyFoundEvent = 10, /* Key packet found */
+ kPGPEvent_OutputEvent = 11, /* Output specification needed */
+ kPGPEvent_SignatureEvent = 12, /* Signature status report */
+ kPGPEvent_BeginLexEvent = 13, /* Initial event per lexical unit*/
+ kPGPEvent_EndLexEvent = 14, /* Final event per lexical unit */
+ kPGPEvent_RecursionEvent = 15, /* Notification of recursive
+ job creation */
+ kPGPEvent_DetachedSignatureEvent = 16, /* Need input for verification of
+ detached signature */
+ kPGPEvent_KeyGenEvent = 17, /* Key generation progress */
+
+ kPGPEvent_KeyServerEvent = 18, /* Key Server progress */
+ kPGPEvent_KeyServerSignEvent= 19, /* Key Server passphrase */
+ kPGPEvent_KeyServerTLSEvent = 20, /* Key Server TLS event */
+ kPGPEvent_KeyServerIdleEvent= 21, /* Idle during keyserver call */
+
+ kPGPEvent_SocketsIdleEvent = 22, /* Idle during sockets */
+ kPGPEvent_DecryptionEvent = 23, /* Decryption data report */
+ kPGPEvent_EncryptionEvent = 24, /* Encryption data report */
+ PGP_ENUM_FORCE( PGPEventType_ )
+};
+PGPENUM_TYPEDEF( PGPEventType_, PGPEventType );
+
+
+/* PGP Analyze event callback codes */
+
+enum PGPAnalyzeType_
+{
+ kPGPAnalyze_Encrypted = 0, /* Encrypted message */
+ kPGPAnalyze_Signed = 1, /* Signed message */
+ kPGPAnalyze_DetachedSignature = 2, /* Detached signature */
+ kPGPAnalyze_Key = 3, /* Key data */
+ kPGPAnalyze_Unknown = 4, /* Non-pgp message */
+ kPGPAnalyze_X509Certificate = 5, /* X.509 certificate */
+
+ PGP_ENUM_FORCE( PGPAnalyzeType_ )
+};
+PGPENUM_TYPEDEF( PGPAnalyzeType_, PGPAnalyzeType );
+
+
+
+
+/* Individual event information structs, combined as a union in PGPEvent */
+
+typedef struct PGPEventNullData_
+{
+ PGPFileOffset bytesWritten;
+ PGPFileOffset bytesTotal;
+} PGPEventNullData;
+
+typedef struct PGPEventErrorData_
+{
+ PGPError error;
+ void *errorArg;
+} PGPEventErrorData;
+
+typedef struct PGPEventWarningData_
+{
+ PGPError warning;
+ void *warningArg;
+} PGPEventWarningData;
+
+typedef struct PGPEventEntropyData_
+{
+ PGPUInt32 entropyBitsNeeded;
+} PGPEventEntropyData;
+
+typedef struct PGPEventPassphraseData_
+{
+ PGPBoolean fConventional;
+ PGPKeySetRef keyset;
+} PGPEventPassphraseData;
+
+typedef struct PGPEventRecipientsData_
+{
+ PGPKeySetRef recipientSet;
+ PGPUInt32 conventionalPassphraseCount;
+ PGPUInt32 keyCount;
+ PGPKeyID const * keyIDArray;
+} PGPEventRecipientsData;
+
+typedef struct PGPEventKeyFoundData_
+{
+ PGPKeySetRef keySet;
+} PGPEventKeyFoundData;
+
+typedef struct PGPEventSignatureData_
+{
+ PGPKeyID signingKeyID;
+ PGPKeyRef signingKey;
+ PGPBoolean checked;
+ PGPBoolean verified;
+ PGPBoolean keyRevoked;
+ PGPBoolean keyDisabled;
+ PGPBoolean keyExpired;
+ PGPBoolean keyMeetsValidityThreshold;
+ PGPValidity keyValidity;
+ PGPTime creationTime;
+} PGPEventSignatureData;
+
+typedef struct PGPEventDecryptionData_
+{
+ PGPCipherAlgorithm cipherAlgorithm;
+ PGPByte *sessionKey;
+ PGPSize sessionKeyLength;
+} PGPEventDecryptionData;
+
+typedef struct PGPEventEncryptionData_
+{
+ PGPCipherAlgorithm cipherAlgorithm;
+ PGPByte *sessionKey;
+ PGPSize sessionKeyLength;
+} PGPEventEncryptionData;
+
+typedef struct PGPEventAnalyzeData_
+{
+ PGPAnalyzeType sectionType;
+} PGPEventAnalyzeData;
+
+typedef struct PGPEventOutputData_
+{
+ PGPUInt32 messageType;
+ char *suggestedName;
+ PGPBoolean forYourEyesOnly;
+} PGPEventOutputData;
+
+typedef struct PGPEventBeginLexData_
+{
+ PGPUInt32 sectionNumber;
+ PGPSize sectionOffset;
+} PGPEventBeginLexData;
+
+typedef struct PGPEventEndLexData_
+{
+ PGPUInt32 sectionNumber;
+} PGPEventEndLexData;
+
+typedef struct PGPEventKeyGenData_
+{
+ PGPUInt32 state;
+} PGPEventKeyGenData;
+
+typedef struct PGPEventKeyServerData_
+{
+ PGPKeyServerRef keyServerRef;
+ PGPUInt32 state; /* PGPKeyServerState */
+} PGPEventKeyServerData;
+
+typedef struct PGPEventKeyServerSignData_
+{
+ PGPKeyServerRef keyServerRef;
+} PGPEventKeyServerSignData;
+
+typedef struct PGPEventKeyServerTLSData_
+{
+ PGPKeyServerRef keyServerRef;
+ PGPUInt32 state; /* PGPKeyServerState */
+ PGPtlsSessionRef tlsSession;
+} PGPEventKeyServerTLSData;
+
+typedef struct PGPEventKeyServerIdleData_
+{
+ PGPKeyServerRef keyServerRef;
+} PGPEventKeyServerIdleData;
+
+
+/*
+ * The following events have no event-specific data defined for them:
+ * kPGPEvent_InsertKeyEvent
+ * kPGPEvent_RecursionEvent
+ * kPGPEvent_DetachedSignatureEvent
+ * kPGPEvent_InitialEvent
+ * kPGPEvent_FinalEvent
+ * kPGPEvent_SocketsIdleEvent
+ */
+
+/* Union of all event data structures above */
+typedef union PGPEventData_
+{
+ PGPEventNullData nullData;
+ PGPEventErrorData errorData;
+ PGPEventWarningData warningData;
+ PGPEventEntropyData entropyData;
+ PGPEventPassphraseData passphraseData;
+ PGPEventRecipientsData recipientsData;
+ PGPEventKeyFoundData keyFoundData;
+ PGPEventSignatureData signatureData;
+ PGPEventDecryptionData decryptionData;
+ PGPEventEncryptionData encryptionData;
+ PGPEventAnalyzeData analyzeData;
+ PGPEventOutputData outputData;
+ PGPEventBeginLexData beginLexData;
+ PGPEventEndLexData endLexData;
+ PGPEventKeyGenData keyGenData;
+ PGPEventKeyServerData keyServerData;
+ PGPEventKeyServerSignData keyServerSignData;
+ PGPEventKeyServerTLSData keyServerTLSData;
+ PGPEventKeyServerIdleData keyServerIdleData;
+} PGPEventData;
+
+/* Refs to internal "job" structure */
+typedef struct PGPJob * PGPJobRef;
+
+#define kInvalidPGPJobRef ((PGPJobRef) NULL)
+#define PGPJobRefIsValid( ref ) ( (ref) != kInvalidPGPJobRef )
+
+/* PGPEvent structure */
+
+struct PGPEvent
+{
+ PGPVersion version; /* Version of event structure */
+ struct PGPEvent_ *nextEvent; /* Allow lists of events */
+ PGPJobRef job; /* Associated with what job */
+ PGPEventType type; /* Type of event */
+ PGPEventData data; /* Event specific data */
+};
+typedef struct PGPEvent PGPEvent;
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=reset
+#endif
+
+PGP_BEGIN_C_DECLARATIONS
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/*
+** Functions to encode and decode. The variable parameters are one or more
+** PGPOptionListRef's which describe the inputs, outputs, and options.
+*/
+
+PGPError PGPEncode(PGPContextRef context,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPDecode(PGPContextRef context,
+ PGPOptionListRef firstOption, ...);
+
+PGPError PGPAddJobOptions(PGPJobRef job,
+ PGPOptionListRef firstOption, ...);
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpEncode_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpErrors.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpErrors.h new file mode 100644 index 0000000000..52ffcfeaca --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpErrors.h @@ -0,0 +1,305 @@ +/*____________________________________________________________________________
+ pgpErrors.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ Error codes for all PGP errors can be found in this file.
+
+ $Id: pgpErrors.h,v 1.96 1999/05/11 19:01:17 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpErrors_h /* [ */
+#define Included_pgpErrors_h
+
+#include "pgpPubTypes.h"
+
+
+#include "pgpPFLErrors.h"
+
+#define kPGPErrorRange 1000
+
+enum PGPError_
+{
+ /*
+ NOTE: error code values must not be changed;
+ compiled client code depends on them.
+ */
+ kPGPError_FirstError = -11500,
+ kPGPError_Last = -10500,
+
+ kPGPError_BadPassphrase = -11500,
+ kPGPError_OptionNotFound = -11499,
+
+/* Errors from pgpEncode */
+ kPGPError_RedundantOptions = -11498,
+ kPGPError_KeyRevoked = -11497,
+ kPGPError_KeyExpired = -11496,
+ kPGPError_KeyDisabled = -11495,
+ kPGPError_KeyInvalid = -11494,
+ kPGPError_KeyUnusableForEncryption = -11493,
+ kPGPError_KeyUnusableForSignature = -11492,
+ kPGPError_OutputBufferTooSmall = -11491,
+ kPGPError_InconsistentEncryptionAlgorithms = -11490,
+ kPGPError_MissingPassphrase = -11489,
+ kPGPError_CombinedConventionalAndPublicEncryption= -11488,
+ kPGPError_DetachedSignatureWithoutSigningKey= -11487,
+ kPGPError_DetachedSignatureWithEncryption = -11486,
+ kPGPError_NoInputOptions = -11485,
+ kPGPError_MultipleInputOptions = -11484,
+ kPGPError_InputFile = -11483,
+ kPGPError_NoOutputOptions = -11482,
+ kPGPError_MultipleOutputOptions = -11481,
+ kPGPError_MissingEventHandler = -11480,
+ kPGPError_MissingKeySet = -11479,
+ kPGPError_DetachedSignatureFound = -11478,
+ kPGPError_NoDecryptionKeyFound = -11477,
+ kPGPError_CorruptSessionKey = -11476,
+ kPGPError_SkipSection = -11475,
+ kPGPError_Interrupted = -11474,
+ kPGPError_TooManyARRKs = -11473,
+ kPGPError_KeyUnusableForDecryption = -11472,
+
+ kPGPError_IncompatibleAPI = -11460,
+
+/* misc errors */
+ kPGPError_NotMacBinary = -11450,
+ kPGPError_NoMacBinaryTranslationAvailable = -11449,
+ kPGPError_BadSignature = -11448,
+ kPGPError_CAPIUnsupportedKey = -11447,
+ kPGPError_SelfTestFailed = -11446,
+ kPGPError_SelfTestsNotExecuted = -11445,
+ kPGPError_BadIntegrity = -11444,
+ kPGPError_DeCompressionFailed = -11443,
+
+/* filter errors */
+
+ kPGPError_InconsistentFilterClasses = -11440,
+ kPGPError_UnsupportedLDAPFilter = -11439,
+ kPGPError_UnsupportedHKPFilter = -11438,
+ kPGPError_UnknownFilterType = -11437,
+ kPGPError_InvalidFilterParameter = -11436,
+ kPGPError_UnsupportedNetToolsCAFilter = -11435,
+
+/* old errors: */
+
+ kPGPError_OutOfRings = -11420,
+ kPGPError_BadHashNumber = -11419,
+ kPGPError_BadCipherNumber = -11418,
+ kPGPError_BadKeyLength = -11417,
+ kPGPError_SizeAdviseFailure = -11416,
+ kPGPError_ConfigParseFailure = -11415,
+ kPGPError_ConfigParseFailureBadFunction = -11414,
+ kPGPError_ConfigParseFailureBadOptions = -11413,
+ kPGPError_KeyIsLocked = -11412,
+ kPGPError_CantDecrypt = -11411,
+ kPGPError_UnknownString2Key = -11410,
+ kPGPError_BadSessionKeySize = -11409,
+ kPGPError_UnknownVersion = -11408,
+ kPGPError_BadSessionKeyAlgorithm = -11407,
+ kPGPError_UnknownSignatureType = -11406,
+ kPGPError_BadSignatureSize = -11405,
+ kPGPError_SignatureBitsWrong = -11404,
+ kPGPError_ExtraDateOnSignature = -11403,
+ kPGPError_SecretKeyNotFound = -11402,
+ kPGPError_AdditionalRecipientRequestKeyNotFound = -11401,
+ kPGPError_InvalidCommit = -11400,
+ kPGPError_CantHash = -11399,
+ kPGPError_UnbalancedScope = -11398,
+ kPGPError_WrongScope = -11397,
+ kPGPError_FIFOReadError = -11396,
+ kPGPError_RandomSeedTooSmall = -11395,
+ kPGPError_EnvPriorityTooLow = -11394,
+ kPGPError_UnknownCharMap = -11393,
+ kPGPError_AsciiParseIncomplete = -11392,
+ kPGPError_BadPacket = -11391,
+
+ kPGPError_TroubleKeySubKey = -11390,
+ kPGPError_TroubleSigSubKey = -11389,
+ kPGPError_TroubleBadTrust = -11388,
+ kPGPError_TroubleUnknownPacketByte = -11387,
+ kPGPError_TroubleUnexpectedSubKey = -11386,
+ kPGPError_TroubleUnexpectedName = -11385,
+ kPGPError_TroubleUnexpectedSignature = -11384,
+ kPGPError_TroubleUnexpectedUnknown = -11383,
+ kPGPError_TroubleUnexpectedTrust = -11382,
+ kPGPError_TroubleKeyTooBig = -11381,
+ kPGPError_TroubleSecretKeyTooBig = -11380,
+ kPGPError_TroubleNameTooBig = -11379,
+ kPGPError_TroubleSignatureTooBig = -11378,
+ kPGPError_TroubleUnknownTooBig = -11377,
+ kPGPError_TroubleDuplicateKeyID = -11376,
+ kPGPError_TroubleDuplicateKey = -11375,
+ kPGPError_TroubleDuplicateSecretKey = -11374,
+ kPGPError_TroubleDuplicateName = -11373,
+ kPGPError_TroubleDuplicateSignature = -11372,
+ kPGPError_TroubleDuplicateUnknown = -11371,
+ kPGPError_TroubleBareKey = -11370,
+ kPGPError_TroubleVersionBugPrev = -11369,
+ kPGPError_TroubleVersionBugCur = -11368,
+ kPGPError_TroubleOldSecretKey = -11367,
+ kPGPError_TroubleNewSecretKey = -11366,
+ kPGPError_TroubleImportingNonexportableSignature= -11365,
+ kPGPError_TroubleDuplicateCRL = -11364,
+ kPGPError_TroubleCRLTooBig = -11363,
+
+ /*
+ * The set of errors in this range are the ones which will NOT abort
+ * a keyring check operation. These errors just make us skip the key
+ * and go on to the next.
+ */
+kPGPError_KEY_MIN = -11350,
+ kPGPError_KEY_LONG = kPGPError_KEY_MIN,
+ kPGPError_KeyPacketTruncated = -11349,
+ kPGPError_UnknownKeyVersion = -11348,
+ kPGPError_UnknownPublicKeyAlgorithm = -11347,
+ kPGPError_MalformedKeyModulus = -11346,
+ kPGPError_MalformedKeyExponent = -11345,
+ kPGPError_RSAPublicModulusIsEven = -11344,
+ kPGPError_RSAPublicExponentIsEven = -11343,
+ kPGPError_MalformedKeyComponent = -11342,
+ kPGPError_KeyTooLarge = -11341,
+ kPGPError_PublicKeyTooSmall = -11340,
+ kPGPError_PublicKeyTooLarge = -11339,
+ kPGPError_PublicKeyUnimplemented = -11338,
+ kPGPError_CRLPacketTruncated = -11337,
+kPGPError_KEY_MAX = kPGPError_PublicKeyUnimplemented,
+
+
+/* kPGPError_SIG_MAX */
+ kPGPError_SIG_LONG = -11330,
+ kPGPError_TruncatedSignature = -11329,
+ kPGPError_MalformedSignatureInteger = -11328,
+ kPGPError_UnknownSignatureAlgorithm = -11327,
+ kPGPError_ExtraSignatureMaterial = -11326,
+ kPGPError_UnknownSignatureVersion = -11325,
+ kPGPError_RevocationKeyNotFound = -11324,
+/* kPGPError_SIG_MIN */
+
+/* kPGPError_KEYDB_MAX */
+ kPGPError_OutOfEntropy = -11320,
+ kPGPError_ItemIsReadOnly = -11319,
+ kPGPError_InvalidProperty = -11318,
+ kPGPError_FileCorrupt = -11317,
+ kPGPError_DuplicateCert = -11316,
+ kPGPError_DuplicateUserID = -11315,
+ kPGPError_CertifyingKeyDead = -11314,
+ kPGPError_ItemWasDeleted = -11313,
+ kPGPError_KeyDBMismatch = -11312,
+/* kPGPError_KEYDB_MIN = kPGPError_KeyDBMismatch */
+
+/* kPGPError_SERVER_MAX */
+ kPGPError_ServerInProgress = -11300,
+ kPGPError_ServerOperationNotSupported = -11299,
+ kPGPError_ServerInvalidProtocol = -11298,
+ kPGPError_ServerRequestFailed = -11297,
+ kPGPError_ServerOpen = -11296,
+ kPGPError_ServerNotOpen = -11295,
+ kPGPError_ServerKeyAlreadyExists = -11294,
+ kPGPError_ServerNotInitialized = -11293,
+ kPGPError_ServerPartialAddFailure = -11292,
+ kPGPError_ServerCorruptKeyBlock = -11291,
+ kPGPError_ServerUnknownResponse = -11290,
+ kPGPError_ServerTimedOut = -11289,
+ kPGPError_ServerOpenFailed = -11288,
+ kPGPError_ServerAuthorizationRequired = -11287,
+ kPGPError_ServerAuthorizationFailed = -11286,
+ kPGPError_ServerSearchFailed = -11285,
+ kPGPError_ServerPartialSearchResults = -11284,
+ kPGPError_ServerBadKeysInSearchResults = -11283,
+ kPGPError_ServerKeyFailedPolicy = -11282,
+ kPGPError_ServerOperationRequiresTLS = -11281,
+ kPGPError_ServerNoStaticStorage = -11280,
+ kPGPError_ServerCertNotFound = -11279,
+
+/* TLS errors */
+ kPGPError_TLSUnexpectedClose = -11250,
+ kPGPError_TLSProtocolViolation = -11249,
+ kPGPError_TLSVersionUnsupported = -11248,
+ kPGPError_TLSWrongState = -11247,
+ kPGPError_TLSAlertReceived = -11246,
+ kPGPError_TLSKeyUnusable = -11245,
+ kPGPError_TLSNoCommonCipher = -11244,
+ kPGPError_TLSWouldBlock = -11243,
+ kPGPError_TLSRcvdHandshakeRequest = -11242,
+
+/* X509 certificate errors */
+ kPGPError_X509NeededCertNotAvailable = -11240,
+ kPGPError_X509SelfSignedCert = -11239,
+ kPGPError_X509InvalidCertificateSignature = -11238,
+ kPGPError_X509InvalidCertificateFormat = -11237,
+
+ kPGPError_BigNumNoInverse = -11150,
+
+/* PGPSockets errors */
+ kPGPError_SocketsNetworkDown = -11100,
+ kPGPError_SocketsNotInitialized = -11099,
+ kPGPError_SocketsInProgress = -11098,
+ kPGPError_SocketsNotConnected = -11097,
+ kPGPError_SocketsNotBound = -11096,
+ kPGPError_SocketsOperationNotSupported = -11095,
+ kPGPError_SocketsProtocolNotSupported = -11094,
+ kPGPError_SocketsAddressFamilyNotSupported = -11093,
+ kPGPError_SocketsNotASocket = -11092,
+ kPGPError_SocketsAddressInUse = -11091,
+ kPGPError_SocketsBufferOverflow = -11090,
+ kPGPError_SocketsListenQueueFull = -11089,
+ kPGPError_SocketsAddressNotAvailable = -11088,
+ kPGPError_SocketsAlreadyConnected = -11087,
+ kPGPError_SocketsTimedOut = -11086,
+ kPGPError_SocketsNoStaticStorage = -11085,
+
+ kPGPError_SocketsHostNotFound = -11050,
+ kPGPError_SocketsDomainServerError = -11049,
+
+/* Errors from X.509 layer */
+ kPGPError_X509AttributeNotSupported = -10999,
+ kPGPError_InvalidPKCS7Encoding = -10998,
+ kPGPError_CMSInitialization = -10997,
+ kPGPError_InvalidDistinguishedName = -10996,
+ kPGPError_CertRequestCreationFailure = -10995,
+ kPGPError_MissingX509Certificate = -10994,
+ kPGPError_PKCS7SignFailure = -10993,
+ kPGPError_ASNPackFailure = -10992,
+ kPGPError_InvalidInputFormat = -10991,
+ kPGPError_InvalidOutputFormat = -10990,
+ kPGPError_InvalidCertificateExtension = -10989,
+ kPGPError_PublicKeyNotFound = -10988,
+
+ kPGPError_CRSMissingRequiredAttribute = -10979,
+ kPGPError_CRSInvalidCharacter = -10978,
+ kPGPError_CRSInvalidAttributeType = -10977,
+ kPGPError_CRSInvalidCertType = -10976,
+ kPGPError_CRSInvalidAttributeValueLength = -10975,
+ kPGPError_CRSInvalidAuthenticateValue = -10974,
+
+
+ kPGPError_DummyEnumValue
+ /* kPGPError_Last */
+} ;
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+PGPError PGPGetErrorString( PGPError theError,
+ PGPSize bufferSize, char * theString );
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+
+#endif /* ] Included_pgpErrors_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpFeatures.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpFeatures.h new file mode 100644 index 0000000000..96016ad2b5 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpFeatures.h @@ -0,0 +1,176 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ Determine which features are present in the PGPsdk. This is the only
+ way to correctly determine which features are present. The version
+ number may be the same for different builds that lack some features.
+
+ $Id: pgpFeatures.h,v 1.18.20.1 1999/08/17 20:04:30 cpeterson Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpFeatures_h /* [ */
+#define Included_pgpFeatures_h
+
+
+#include "pgpPubTypes.h"
+
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=mac68k /* [ */
+#endif
+
+
+/*____________________________________________________________________________
+ Each selector designates a PGPFlags word, which can be obtained via
+ PGPGetFeatureFlags(). The flags can be tested using the
+ supplied masks. We can add more selectors as needed. The masks
+ are not intended to be restricted to a single bit.
+ Flags should not be used for attributes that have unknown length.
+
+ A kPGPError_ItemNotFound will be returned if the caller specifies
+ a selector which is not recognized by the PGPsdk. This could
+ occur if an app links to an older version of the SDK.
+____________________________________________________________________________*/
+
+/* selectors which are passed to PGPGetFeatureFlags */
+enum PGPFeatureSelector_
+{
+ kPGPFeatures_GeneralSelector = 1,
+ kPGPFeatures_ImplementationSelector = 2,
+ PGP_ENUM_FORCE( PGPFeatureSelector_ )
+};
+PGPENUM_TYPEDEF( PGPFeatureSelector_, PGPFeatureSelector );
+
+
+/* flags for kPGPFeatures_GeneralSelector */
+enum
+{
+ kPGPFeatureMask_CanEncrypt = 0x1,
+ kPGPFeatureMask_CanDecrypt = 0x2,
+ kPGPFeatureMask_CanSign = 0x4,
+ kPGPFeatureMask_CanVerify = 0x8,
+ kPGPFeatureMask_CanGenerate = 0x10,
+ kPGPFeatureMask_RngHardware = 0x20
+};
+
+
+/* flags for kPGPFeatures_ImplementationSelector */
+enum
+{
+ kPGPFeatureMask_IsDebugBuild = 0x1,
+ kPGPFeatureMask_HasTimeout = 0x2
+};
+
+
+
+typedef struct PGPAlgorithmInfo
+{
+ char shortName[ 32 ];
+ char longName[ 96 ];
+ char copyright[ 128 ];
+ PGPFlags flags; /* reserved; 0 for now */
+ PGPUInt32 reserved[ 16 ]; /* reserved; 0 for now */
+} PGPAlgorithmInfo;
+
+
+typedef struct PGPPublicKeyAlgorithmInfo
+{
+ PGPAlgorithmInfo info;
+
+ PGPPublicKeyAlgorithm algID;
+
+ PGPBoolean canEncrypt;
+ PGPBoolean canDecrypt;
+ PGPBoolean canSign;
+ PGPBoolean canVerify;
+ PGPBoolean canGenerate;
+ PGPBoolean reserved1;
+ PGPBoolean reserved2;
+ PGPBoolean reserved3;
+
+ PGPUInt32 reserved[ 8 ];
+} PGPPublicKeyAlgorithmInfo;
+
+
+typedef struct PGPSymmetricCipherInfo
+{
+ PGPAlgorithmInfo info;
+
+ PGPCipherAlgorithm algID;
+
+ PGPUInt32 reserved[ 8 ];
+} PGPSymmetricCipherInfo;
+
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=reset /* ] */
+#endif
+
+
+
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+/* see kPGPsdkAPIVersion in pgpUtilities.h for version format */
+PGPError PGPGetSDKVersion( PGPUInt32 *version );
+
+
+/*____________________________________________________________________________
+ Return a C string of the form:
+
+ "PGPsdk version 1.0 (C) Network Associates, Inc"
+____________________________________________________________________________*/
+PGPError PGPGetSDKString( char theString[ 256 ] );
+
+
+
+/* return a flags word for the feature selector */
+PGPError PGPGetFeatureFlags( PGPFeatureSelector selector,
+ PGPFlags *flags );
+
+/* use this to test whether a feature exists after getting flags */
+#define PGPFeatureExists( flags, maskValue ) \
+ ( ( (flags) & (maskValue) ) != 0 )
+
+
+/*____________________________________________________________________________
+ Routines to determine which algorithms are present.
+
+ To determine if a specific algorithm is available, you will need to
+ index through the available algorithms and check the algorithm ID.
+____________________________________________________________________________*/
+PGPError PGPCountPublicKeyAlgorithms( PGPUInt32 *numPKAlgs );
+PGPError PGPGetIndexedPublicKeyAlgorithmInfo( PGPUInt32 theIndex,
+ PGPPublicKeyAlgorithmInfo *info);
+
+PGPError PGPCountSymmetricCiphers( PGPUInt32 *numPKAlgs );
+PGPError PGPGetIndexedSymmetricCipherInfo( PGPUInt32 theIndex,
+ PGPSymmetricCipherInfo *info);
+
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+
+
+
+#endif /* ] Included_pgpFeatures_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpGroups.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpGroups.h new file mode 100644 index 0000000000..65e4bc209a --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpGroups.h @@ -0,0 +1,322 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpGroups.h,v 1.6 1999/03/10 02:51:18 heller Exp $
+____________________________________________________________________________*/
+
+#ifndef Included_pgpGroups_h /* [ */
+#define Included_pgpGroups_h
+
+#include "pgpPubTypes.h"
+#include "pgpEncode.h"
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=mac68k
+#endif
+
+#define kPGPMaxGroupNameLength 63
+#define kPGPMaxGroupDescriptionLength 63
+
+typedef char PGPGroupName[ kPGPMaxGroupNameLength + 1 ];
+typedef char PGPGroupDescription[ kPGPMaxGroupDescriptionLength + 1 ];
+
+
+typedef struct PGPGroupSet * PGPGroupSetRef;
+typedef struct PGPGroupIter * PGPGroupItemIterRef;
+
+#define kInvalidPGPGroupSetRef ((PGPGroupSetRef) NULL)
+#define kInvalidPGPGroupItemIterRef ((PGPGroupItemIterRef) NULL)
+
+#define PGPGroupSetRefIsValid(ref) ((ref) != kInvalidPGPGroupSetRef)
+#define PGPGroupItemIterRefIsValid(ref) ((ref) != kInvalidPGPGroupItemIterRef)
+
+/* any type will do that is distinct */
+typedef PGPUInt32 PGPGroupID;
+#define kPGPInvalidGroupID ( (PGPGroupID)0 )
+
+enum PGPGroupItemType_
+{
+ kPGPGroupItem_KeyID = 1,
+ kPGPGroupItem_Group,
+
+ PGP_ENUM_FORCE( PGPGroupItemType_)
+};
+PGPENUM_TYPEDEF( PGPGroupItemType_, PGPGroupItemType );
+
+/*____________________________________________________________________________
+ A run-time group item, used when iterating through a group.
+ For client use; not necessarily the internal storage format.
+
+ 'userValue' is *not* saved to disk.
+____________________________________________________________________________*/
+
+typedef struct PGPGroupItem
+{
+ PGPGroupItemType type;
+ PGPUserValue userValue;
+
+ union
+ {
+ /* type selects which substructure */
+ struct /* if kGroupItem_Group */
+ {
+ PGPGroupID id;
+ } group;
+
+ struct /* if kGroupItem_KeyID */
+ {
+ PGPPublicKeyAlgorithm algorithm;
+ PGPKeyID keyID;
+ } key;
+ } u;
+
+ PGPUInt32 reserved[4];
+
+} PGPGroupItem;
+
+
+typedef PGPInt32 (*PGPGroupItemCompareProc)( PGPGroupItem *,
+ PGPGroupItem *, PGPUserValue userValue );
+
+/*____________________________________________________________________________
+ Info obtained via PGPGetGroupInfo.
+____________________________________________________________________________*/
+
+typedef struct PGPGroupInfo
+{
+ PGPGroupID id;
+ PGPGroupName name;
+ PGPGroupName description;
+ PGPUserValue userValue;
+
+} PGPGroupInfo;
+
+
+typedef PGPFlags PGPGroupItemIterFlags;
+/* flag (1UL << 0 ) is reserved */
+#define kPGPGroupIterFlags_Recursive (PGPFlags)(1UL << 1 )
+#define kPGPGroupIterFlags_Keys (PGPFlags)(1UL << 2 )
+#define kPGPGroupIterFlags_Groups (PGPFlags)(1UL << 3 )
+
+#define kPGPGroupIterFlags_AllKeysRecursive \
+ ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_Keys )
+
+#define kPGPGroupIterFlags_AllGroupsRecursive \
+ ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_Groups )
+
+#define kPGPGroupIterFlags_AllItems \
+ ( kPGPGroupIterFlags_Keys | kPGPGroupIterFlags_Groups )
+
+#define kPGPGroupIterFlags_AllRecursive \
+ ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_AllItems )
+
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=reset
+#endif
+
+PGP_BEGIN_C_DECLARATIONS
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+/*____________________________________________________________________________
+ Manipulating pgp group sets (PGPGroupSetRef)
+____________________________________________________________________________*/
+/* create a new, empty groups collection */
+PGPError PGPNewGroupSet( PGPContextRef context, PGPGroupSetRef *outRef );
+
+/* file is *not* left open; all data is loaded into memory */
+PGPError PGPNewGroupSetFromFile( PGPContextRef context,
+ PGPFileSpecRef file,
+ PGPGroupSetRef *outRef );
+
+#if PGP_MACINTOSH
+PGPError PGPNewGroupSetFromFSSpec( PGPContextRef context,
+ const FSSpec *spec, PGPGroupSetRef *outRef );
+#endif
+
+/* overwrites existing. Don't bother unless PGPGroupSetNeedsCommit() */
+PGPError PGPSaveGroupSetToFile( PGPGroupSetRef set, PGPFileSpecRef file );
+
+/* free all data structures; be sure to save first if you want */
+PGPError PGPFreeGroupSet( PGPGroupSetRef set );
+
+
+/* has the group changed? */
+PGPBoolean PGPGroupSetNeedsCommit( PGPGroupSetRef set );
+
+PGPContextRef PGPGetGroupSetContext( PGPGroupSetRef set );
+
+/* export the groupset to a buffer. Use PGPFreeData to free the buffer */
+PGPError PGPExportGroupSetToBuffer( PGPGroupSetRef set, void **buffer,
+ PGPSize *bufferSize );
+
+/* import a groupset from a buffer */
+PGPError PGPImportGroupSetFromBuffer(PGPContextRef context, void *buffer,
+ PGPSize bufSize, PGPGroupSetRef *outSet );
+
+/*____________________________________________________________________________
+ Manipulating groups
+
+ Groups are always referred to by IDs which remain valid until the set
+ is disposed.
+____________________________________________________________________________*/
+
+/* initial parent ID is kPGPInvalidGroupID */
+PGPError PGPNewGroup( PGPGroupSetRef set,
+ const char * name, const char *description, PGPGroupID *id );
+
+PGPError PGPCountGroupsInSet( PGPGroupSetRef set,
+ PGPUInt32 *numGroups);
+PGPError PGPGetIndGroupID( PGPGroupSetRef set,
+ PGPUInt32 groupIndex, PGPGroupID *id );
+
+/* delete this group from the set */
+/* All references to it are removed in all sets */
+PGPError PGPDeleteGroup( PGPGroupSetRef set, PGPGroupID id );
+
+/* delete the indexed item from the group */
+/* the item may be a group or a key */
+PGPError PGPDeleteIndItemFromGroup( PGPGroupSetRef set,
+ PGPGroupID id, PGPUInt32 item );
+
+/* same as PGPDeleteIndItemFromGroup, but accepts an item */
+PGPError PGPDeleteItemFromGroup( PGPGroupSetRef set,
+ PGPGroupID id, PGPGroupItem const *item );
+
+
+PGPError PGPGetGroupInfo( PGPGroupSetRef set,
+ PGPGroupID id, PGPGroupInfo *info );
+
+PGPError PGPSetGroupName( PGPGroupSetRef set,
+ PGPGroupID id, const char * name );
+PGPError PGPSetGroupUserValue( PGPGroupSetRef set,
+ PGPGroupID id, PGPUserValue userValue );
+PGPError PGPSetGroupDescription( PGPGroupSetRef set,
+ PGPGroupID id, const char * name );
+
+/* 'item' specifies a group or a key id */
+/* you must fill the item in completely */
+PGPError PGPAddItemToGroup( PGPGroupSetRef set,
+ PGPGroupItem const *item, PGPGroupID group );
+
+
+PGPError PGPMergeGroupIntoDifferentSet( PGPGroupSetRef fromSet,
+ PGPGroupID fromID, PGPGroupSetRef toSet );
+
+PGPError PGPMergeGroupSets( PGPGroupSetRef fromSet,
+ PGPGroupSetRef intoSet );
+
+PGPError PGPCopyGroupSet(PGPGroupSetRef sourceSet,
+ PGPGroupSetRef *destSet);
+
+/*____________________________________________________________________________
+ Manipulating group items
+____________________________________________________________________________*/
+
+/* count how many items there are in a group */
+/* totalItems includes keys and groups */
+PGPError PGPCountGroupItems( PGPGroupSetRef set,
+ PGPGroupID id, PGPBoolean recursive,
+ PGPUInt32 * numKeys,
+ PGPUInt32 * totalItems );
+
+/* non-recursive call; index only applies to group itself */
+PGPError PGPGetIndGroupItem( PGPGroupSetRef set,
+ PGPGroupID id, PGPUInt32 groupIndex, PGPGroupItem * item );
+
+/* use PGPGetIndGroupItem() if you want to get the user value */
+PGPError PGPSetIndGroupItemUserValue( PGPGroupSetRef set,
+ PGPGroupID id, PGPUInt32 groupIndex, PGPUserValue userValue );
+
+PGPError PGPSortGroupItems( PGPGroupSetRef set, PGPGroupID id,
+ PGPGroupItemCompareProc, PGPUserValue userValue );
+
+PGPError PGPSortGroupSet( PGPGroupSetRef set,
+ PGPGroupItemCompareProc, PGPUserValue userValue );
+
+/*____________________________________________________________________________
+ PGPGroupItemIterRef--iterator through group items.
+
+ Special note: this is not a full-fledged iterator. You may *not* add
+ or delete items while iterating and you may only move forward. However,
+ you may change the values of items.
+____________________________________________________________________________*/
+
+PGPError PGPNewGroupItemIter( PGPGroupSetRef set, PGPGroupID id,
+ PGPGroupItemIterFlags flags, PGPGroupItemIterRef *iter );
+
+PGPError PGPFreeGroupItemIter( PGPGroupItemIterRef iter );
+
+/* returns kPGPError_EndOfIteration when done */
+PGPError PGPGroupItemIterNext( PGPGroupItemIterRef iter,
+ PGPGroupItem * item );
+
+/*____________________________________________________________________________
+ Group utilities
+____________________________________________________________________________*/
+
+/*____________________________________________________________________________
+ Return the lowest validity of any item in the group
+ keyset should contain all keys available
+ It is not an error if keys can't be found; you may want to check
+ the not found count.
+
+ The lowest validity is kPGPValidity_Invalid and kPGPValidity_Unknown
+ is never returned.
+____________________________________________________________________________*/
+PGPError PGPGetGroupLowestValidity( PGPGroupSetRef set, PGPGroupID id,
+ PGPKeySetRef keySet, PGPValidity * lowestValidity,
+ PGPUInt32 * numKeysNotFound);
+
+/*____________________________________________________________________________
+ All all the keys in the group (and its subgroups) to the keyset
+____________________________________________________________________________*/
+PGPError PGPNewKeySetFromGroup( PGPGroupSetRef set, PGPGroupID id,
+ PGPKeySetRef masterSet, PGPKeySetRef * resultSet,
+ PGPUInt32 * numKeysNotFound);
+
+/*____________________________________________________________________________
+ Create a simple, flattened group of unique key IDs from the source group.
+ Note that sourceSet and destSet must be different.
+____________________________________________________________________________*/
+PGPError PGPNewFlattenedGroupFromGroup(PGPGroupSetRef sourceSet,
+ PGPGroupID sourceID, PGPGroupSetRef destSet,
+ PGPGroupID *destID);
+
+/*____________________________________________________________________________
+ Perform a "standard" sort on a group
+____________________________________________________________________________*/
+PGPError PGPSortGroupSetStd( PGPGroupSetRef set, PGPKeySetRef keys );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpGroups_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
+
+
+
+
+
+
+
+
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpHMAC.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpHMAC.h new file mode 100644 index 0000000000..a04dc9545d --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpHMAC.h @@ -0,0 +1,75 @@ +/*____________________________________________________________________________
+ pgpHMAC.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpHMAC.h,v 1.3 1999/03/10 02:51:38 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpHMAC_h /* [ */
+#define Included_pgpHMAC_h
+
+#include "pgpPubTypes.h"
+#include "pgpMemoryMgr.h"
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/*____________________________________________________________________________
+ Create a new HMAC of the specified algorithm.
+
+ If the algorithm is not available then kPGPError_AlgorithmNotAvailable is
+ returned.
+____________________________________________________________________________*/
+PGPError PGPNewHMACContext( PGPMemoryMgrRef memoryMgr,
+ PGPHashAlgorithm algorithm,
+ PGPByte * secret,
+ PGPSize secretLen,
+ PGPHMACContextRef * outRef );
+
+/*____________________________________________________________________________
+ Any existing intermediate HMAC is lost.
+____________________________________________________________________________*/
+PGPError PGPFreeHMACContext( PGPHMACContextRef ref );
+
+/*____________________________________________________________________________
+ Reset an HMAC as if it had been created anew. Any existing intermediate
+ hash is lost.
+____________________________________________________________________________*/
+PGPError PGPResetHMAC( PGPHMACContextRef ref );
+
+/*____________________________________________________________________________
+ Continue the HMAC, accumulating an intermediate result
+____________________________________________________________________________*/
+PGPError PGPContinueHMAC( PGPHMACContextRef ref,
+ const void *in, PGPSize numBytes );
+
+
+/*____________________________________________________________________________
+ Finalize the HMAC, depositing the result into 'hmacOut'.
+
+ This size of the output will be the same size as the hash
+ algorithm output.
+____________________________________________________________________________*/
+PGPError PGPFinalizeHMAC( PGPHMACContextRef ref, void *hmacOut );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpHMAC_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpHash.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpHash.h new file mode 100644 index 0000000000..101120d47a --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpHash.h @@ -0,0 +1,95 @@ +/*____________________________________________________________________________
+ pgpHash.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpHash.h,v 1.15 1999/03/10 02:51:20 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpHashing_h /* [ */
+#define Included_pgpHashing_h
+
+#include "pgpPubTypes.h"
+#include "pgpMemoryMgr.h"
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/*____________________________________________________________________________
+ Create a new hash of the specified algorithm.
+
+ If the algorithm is not available then kPGPError_AlgorithmNotAvailable is
+ returned.
+____________________________________________________________________________*/
+PGPError PGPNewHashContext( PGPMemoryMgrRef memoryMgr,
+ PGPHashAlgorithm algorithm,
+ PGPHashContextRef * outRef );
+
+
+/*____________________________________________________________________________
+ Any existing intermediate hash is lost.
+____________________________________________________________________________*/
+PGPError PGPFreeHashContext( PGPHashContextRef ref );
+
+
+/*____________________________________________________________________________
+ An exact duplicate of the hash is made.
+____________________________________________________________________________*/
+PGPError PGPCopyHashContext( PGPHashContextRef ref,
+ PGPHashContextRef * outRef);
+
+
+
+/*____________________________________________________________________________
+ Reset a hash as if it had been created anew. Any existing intermediate
+ hash is lost.
+____________________________________________________________________________*/
+PGPError PGPResetHash( PGPHashContextRef ref );
+
+
+/*____________________________________________________________________________
+ Continue the hash, accumulating an intermediate result
+____________________________________________________________________________*/
+PGPError PGPContinueHash( PGPHashContextRef ref,
+ const void *in, PGPSize numBytes );
+
+
+/*____________________________________________________________________________
+ Finalize the hash, depositing the result into 'hashOut'.
+
+ After calling this routine, the hash is reset via PGPResetHash().
+ If you want an intermediate result, use PGPCopyHash() and finalize the
+ copy.
+____________________________________________________________________________*/
+PGPError PGPFinalizeHash( PGPHashContextRef ref, void *hashOut );
+
+
+/*____________________________________________________________________________
+ Determine size of resulting hash in bytes e.g. a 160 bit hash yields 20.
+ Used for generic code which may not know how big a hash is being produced.
+
+ Question: can we reasonably assume 8 bits per byte? If not, how does
+ PGPFinalizeHash return its result?
+____________________________________________________________________________*/
+PGPError PGPGetHashSize( PGPHashContextRef ref, PGPSize *hashSize );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpHashing_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpKeyServer.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpKeyServer.h new file mode 100644 index 0000000000..25579aacd0 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpKeyServer.h @@ -0,0 +1,360 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+
+
+ $Id: pgpKeyServer.h,v 1.43 1999/04/12 18:59:57 jason Exp $
+____________________________________________________________________________*/
+
+#ifndef Included_pgpKeyServer_h
+#define Included_pgpKeyServer_h
+
+#include "pgpOptionList.h"
+#include "pgpErrors.h"
+#include "pgpGroups.h"
+#include "pgpTLS.h"
+
+
+enum PGPKeyServerState_
+{
+ kPGPKeyServerState_Invalid = 0,
+ kPGPKeyServerState_Opening = 1,
+ kPGPKeyServerState_Querying = 2,
+ kPGPKeyServerState_ReceivingResults = 3,
+ kPGPKeyServerState_ProcessingResults = 4,
+ kPGPKeyServerState_Uploading = 5,
+ kPGPKeyServerState_Deleting = 6,
+ kPGPKeyServerState_Disabling = 7,
+ kPGPKeyServerState_Closing = 8,
+
+ kPGPKeyServerState_TLSUnableToSecureConnection = 9,
+ kPGPKeyServerState_TLSConnectionSecured = 10,
+
+ PGP_ENUM_FORCE(PGPKeyServerState_)
+};
+
+PGPENUM_TYPEDEF(PGPKeyServerState_, PGPKeyServerState);
+
+enum PGPKeyServerProtocol_
+{
+ kPGPKeyServerProtocol_Invalid = 0,
+ kPGPKeyServerProtocol_LDAP = 1,
+ kPGPKeyServerProtocol_HTTP = 2,
+ kPGPKeyServerProtocol_LDAPS = 3,
+ kPGPKeyServerProtocol_HTTPS = 4,
+
+ PGP_ENUM_FORCE( PGPKeyServerProtocol_ )
+};
+
+PGPENUM_TYPEDEF( PGPKeyServerProtocol_, PGPKeyServerProtocol );
+
+enum PGPKeyServerClass_
+{
+ kPGPKeyServerClass_Invalid = 0,
+ kPGPKeyServerClass_PGP = 1,
+ kPGPKeyServerClass_NetToolsCA = 2,
+ kPGPKeyServerClass_Verisign = 3,
+ kPGPKeyServerClass_Entrust = 4,
+
+ PGP_ENUM_FORCE( PGPKeyServerClass_ )
+};
+
+PGPENUM_TYPEDEF( PGPKeyServerClass_, PGPKeyServerClass );
+
+enum PGPKeyServerKeySpace_ /* These are only valid for LDAP keyservers */
+{
+ kPGPKeyServerKeySpace_Invalid = 0,
+ kPGPKeyServerKeySpace_Default = 1,
+ kPGPKeyServerKeySpace_Normal = 2,
+ kPGPKeyServerKeySpace_Pending = 3,
+
+ PGP_ENUM_FORCE( PGPKeyServerKeySpace_ )
+};
+
+PGPENUM_TYPEDEF( PGPKeyServerKeySpace_, PGPKeyServerKeySpace );
+
+enum PGPKeyServerAccessType_ /* These are only valid for LDAP keyservers */
+{
+ kPGPKeyServerAccessType_Invalid = 0,
+ kPGPKeyServerAccessType_Default = 1,
+ kPGPKeyServerAccessType_Normal = 2,
+ kPGPKeyServerAccessType_Administrator = 3,
+
+ PGP_ENUM_FORCE( PGPKeyServerAccessType_ )
+};
+
+PGPENUM_TYPEDEF( PGPKeyServerAccessType_, PGPKeyServerAccessType );
+
+/* PGPKeyServerMonitorValues are null terminated linked lists.
+ The values member is a null terminated array of char*s.
+*/
+
+typedef struct PGPKeyServerMonitorValues
+{
+ char * name;
+ char ** values;
+ struct PGPKeyServerMonitorValues * next;
+} PGPKeyServerMonitorValues;
+
+typedef struct PGPKeyServerMonitor
+{
+ PGPKeyServerRef keyServerRef;
+ PGPKeyServerMonitorValues * valuesHead;
+} PGPKeyServerMonitor;
+
+
+typedef struct PGPKeyServerThreadStorage * PGPKeyServerThreadStorageRef;
+# define kInvalidPGPKeyServerThreadStorageRef \
+ ((PGPKeyServerThreadStorageRef) NULL)
+#define PGPKeyServerThreadStorageRefIsValid(ref) \
+ ((ref) != kInvalidPGPKeyServerThreadStorageRef)
+
+#if PGP_DEPRECATED /* [ */
+
+#define kPGPKeyServerType_Invalid kPGPKeyServerProtocol_Invalid
+#define kPGPKeyServerType_LDAP kPGPKeyServerProtocol_LDAP
+#define kPGPKeyServerType_HTTP kPGPKeyServerProtocol_HTTP
+#define kPGPKeyServerType_LDAPS kPGPKeyServerProtocol_LDAPS
+#define kPGPKeyServerType_HTTPS kPGPKeyServerProtocol_HTTPS
+
+typedef PGPKeyServerProtocol PGPKeyServerType;
+
+#endif /* ] PGP_DEPRECATED */
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+/* Use the idle event handler to receive periodic idle events during
+ network calls. Usually this is used only in non-preemptive multi-tasking
+ OSes to allow yielding in threads. Pre-emptive multi-tasking systems
+ should probably not use the call as it interrupts the efficient wait state
+ of threads waiting on network calls.
+
+ Idle event handlers need to be added on a per thread basis.
+
+ Returning an error from the idle event handler will cause the keyserver
+ to quit processing and to return a kPGPError_UserAbort. */
+PGPError PGPSetKeyServerIdleEventHandler(
+ PGPEventHandlerProcPtr inCallback,
+ PGPUserValue inUserData);
+
+PGPError PGPGetKeyServerIdleEventHandler(
+ PGPEventHandlerProcPtr * outCallback,
+ PGPUserValue * outUserData);
+
+/* Network library options */
+
+PGPOptionListRef PGPONetURL(PGPContextRef context, const char *url);
+
+PGPOptionListRef PGPONetHostName(PGPContextRef context,
+ const char *hostName, PGPUInt16 port);
+
+PGPOptionListRef PGPONetHostAddress(PGPContextRef context,
+ PGPUInt32 hostAddress, PGPUInt16 port);
+
+PGPOptionListRef PGPOKeyServerProtocol(PGPContextRef context,
+ PGPKeyServerProtocol serverProtocol);
+
+PGPOptionListRef PGPOKeyServerKeySpace(PGPContextRef context,
+ PGPKeyServerKeySpace serverSpace);
+
+PGPOptionListRef PGPOKeyServerAccessType(PGPContextRef context,
+ PGPKeyServerAccessType accessType);
+
+PGPOptionListRef PGPOKeyServerCAKey(PGPContextRef context,
+ PGPKeyRef caKey);
+
+PGPOptionListRef PGPOKeyServerRequestKey(PGPContextRef context,
+ PGPKeyRef requestKey);
+
+PGPOptionListRef PGPOKeyServerSearchKey(PGPContextRef context,
+ PGPKeyRef searchKey);
+
+PGPOptionListRef PGPOKeyServerSearchFilter(PGPContextRef context,
+ PGPFilterRef searchFilter);
+
+/* Static storage creation */
+PGPError PGPKeyServerCreateThreadStorage(
+ PGPKeyServerThreadStorageRef * outPreviousStorage);
+PGPError PGPKeyServerDisposeThreadStorage(
+ PGPKeyServerThreadStorageRef inPreviousStorage);
+
+/* Initialize and close the keyserver library */
+PGPError PGPKeyServerInit(void);
+
+PGPError PGPKeyServerCleanup(void);
+
+
+/* Creating and freeing a keyserver ref. */
+PGPError PGPNewKeyServer(
+ PGPContextRef inContext,
+ PGPKeyServerClass inClass,
+ PGPKeyServerRef *outKeyServerRef,
+ PGPOptionListRef firstOption,
+ ... );
+
+PGPError PGPFreeKeyServer(PGPKeyServerRef inKeyServerRef);
+PGPError PGPIncKeyServerRefCount(PGPKeyServerRef inKeyServerRef);
+
+
+/* Set and get the keyserver's event handler. Note that returning an error
+ for a keyserver event will abort the current call. */
+PGPError PGPSetKeyServerEventHandler(
+ PGPKeyServerRef inKeyServerRef,
+ PGPEventHandlerProcPtr inCallback,
+ PGPUserValue inUserData);
+
+PGPError PGPGetKeyServerEventHandler(
+ PGPKeyServerRef inKeyServerRef,
+ PGPEventHandlerProcPtr * outCallback,
+ PGPUserValue * outUserData);
+
+
+/* Canceling a call to a keyserver. This is the only call that can be made
+ to a keyserver that is currently in another call. Also, once you have
+ returned from a canceled call, you may only close the keyserver. */
+PGPError PGPCancelKeyServerCall(PGPKeyServerRef inKeyServerRef);
+
+
+/* Opening and closing the keyserver. A keyserver ref can be opened and
+ closed multiple times as necessary. */
+PGPError PGPKeyServerOpen(PGPKeyServerRef inKeyServerRef,
+ PGPtlsSessionRef inTLSSessionRef);
+
+PGPError PGPKeyServerClose(PGPKeyServerRef inKeyServerRef);
+
+
+/* Get keyserver info. */
+PGPError PGPGetKeyServerTLSSession(PGPKeyServerRef inKeyServerRef,
+ PGPtlsSessionRef * outTLSSessionRef);
+
+PGPError PGPGetKeyServerProtocol(PGPKeyServerRef inKeyServerRef,
+ PGPKeyServerProtocol * outType);
+
+PGPError PGPGetKeyServerAccessType(PGPKeyServerRef inKeyServerRef,
+ PGPKeyServerAccessType * outAccessType);
+
+PGPError PGPGetKeyServerKeySpace(PGPKeyServerRef inKeyServerRef,
+ PGPKeyServerKeySpace * outKeySpace);
+
+PGPError PGPGetKeyServerPort(PGPKeyServerRef inKeyServerRef,
+ PGPUInt16 * outPort);
+
+PGPError PGPGetKeyServerHostName(PGPKeyServerRef inKeyServerRef,
+ char ** outHostName); /* Use PGPFreeData to free */
+
+PGPError PGPGetKeyServerAddress(PGPKeyServerRef inKeyServerRef,
+ PGPUInt32 * outAddress);
+
+PGPError PGPGetKeyServerPath(PGPKeyServerRef inKeyServerRef,
+ char ** outPath); /* Use PGPFreeData to free */
+
+PGPContextRef PGPGetKeyServerContext(PGPKeyServerRef inKeyServerRef);
+
+/* If there was an error string returned from the server, you can get it with
+ this function. Note that if there is no string, the function will return
+ kPGPError_NoErr and *outErrorString will be NULL */
+PGPError PGPGetLastKeyServerErrorString(
+ PGPKeyServerRef inKeyServerRef,
+ char ** outErrorString); /* Use PGPFreeData to free */
+
+
+/* These functions may be used with both HTTP and LDAP keyservers */
+PGPError PGPQueryKeyServer(PGPKeyServerRef inKeyServerRef,
+ PGPFilterRef inFilterRef,
+ PGPKeySetRef * outFoundKeys);
+
+PGPError PGPUploadToKeyServer(PGPKeyServerRef inKeyServerRef,
+ PGPKeySetRef inKeysToUpload,
+ PGPKeySetRef * outKeysThatFailed);
+
+
+/* These functions may only be used with LDAP keyservers */
+PGPError PGPDeleteFromKeyServer(PGPKeyServerRef inKeyServerRef,
+ PGPKeySetRef inKeysToDelete,
+ PGPKeySetRef * outKeysThatFailed);
+
+PGPError PGPDisableFromKeyServer(PGPKeyServerRef inKeyServerRef,
+ PGPKeySetRef inKeysToDisable,
+ PGPKeySetRef * outKeysThatFailed);
+
+PGPError PGPSendGroupsToServer(PGPKeyServerRef inKeyServerRef,
+ PGPGroupSetRef inGroupSetRef);
+
+PGPError PGPRetrieveGroupsFromServer(
+ PGPKeyServerRef inKeyServerRef,
+ PGPGroupSetRef * outGroupSetRef);
+
+PGPError PGPNewServerMonitor(PGPKeyServerRef inKeyServerRef,
+ PGPKeyServerMonitor ** outMonitor);
+
+PGPError PGPFreeServerMonitor(PGPKeyServerMonitor * inMonitor);
+
+/* X.509 Certificate Request functions */
+
+PGPError PGPSendCertificateRequest(
+ PGPKeyServerRef inKeyServerRef,
+ PGPOptionListRef firstOption,
+ ... );
+
+PGPError PGPRetrieveCertificate(
+ PGPKeyServerRef inKeyServerRef,
+ PGPOptionListRef firstOption,
+ ... );
+
+PGPError PGPRetrieveCertificateRevocationList(
+ PGPKeyServerRef inKeyServerRef,
+ PGPOptionListRef firstOption,
+ ... );
+
+/***************************************************************************
+****************************************************************************
+ NOTE: These functions are deprecated and should not be used
+
+ PGPGetKeyServerType -> PGPGetKeyServerProtocol
+ PGPNewKeyServerFromURL -> PGPNewKeyServer
+ PGPNewKeyServerFromHostName -> PGPNewKeyServer
+ PGPNewKeyServerFromHostAddress -> PGPNewKeyServer
+
+****************************************************************************
+***************************************************************************/
+
+#if PGP_DEPRECATED /* [ */
+
+PGPError PGPNewKeyServerFromURL(PGPContextRef inContext,
+ const char * inURL,
+ PGPKeyServerAccessType inAccessType,
+ PGPKeyServerKeySpace inKeySpace,
+ PGPKeyServerRef * outKeyServerRef);
+
+PGPError PGPNewKeyServerFromHostName(PGPContextRef inContext,
+ const char * inHostName,
+ PGPUInt16 inPort, /* default for protocol if 0 */
+ PGPKeyServerProtocol inType,
+ PGPKeyServerAccessType inAccessType,
+ PGPKeyServerKeySpace inKeySpace,
+ PGPKeyServerRef * outKeyServerRef);
+
+PGPError PGPNewKeyServerFromHostAddress(PGPContextRef inContext,
+ PGPUInt32 inAddress,
+ PGPUInt16 inPort, /* default for protocol if 0 */
+ PGPKeyServerProtocol inType,
+ PGPKeyServerAccessType inAccessType,
+ PGPKeyServerKeySpace inKeySpace,
+ PGPKeyServerRef * outKeyServerRef);
+
+PGPError PGPGetKeyServerType(PGPKeyServerRef inKeyServerRef,
+ PGPKeyServerType * outType);
+
+#endif /* ] PGP_DEPRECATED */
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpKeys.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpKeys.h new file mode 100644 index 0000000000..8bfdc34cc3 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpKeys.h @@ -0,0 +1,879 @@ +/*____________________________________________________________________________
+ pgpKeys.h
+
+ Copyright(C) 1996,1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ Public definitions for PGP KeyDB Library
+
+ $Id: pgpKeys.h,v 1.132 1999/05/18 19:38:45 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpKeys_h /* [ */
+#define Included_pgpKeys_h
+
+
+
+#include "pgpPubTypes.h"
+#include "pgpHash.h"
+#include "pgpOptionList.h"
+
+
+
+/* Key ordering */
+enum PGPKeyOrdering_
+{
+ kPGPInvalidOrdering = 0,
+ kPGPAnyOrdering = 1,
+ kPGPUserIDOrdering = 2,
+ kPGPReverseUserIDOrdering = 3,
+ kPGPKeyIDOrdering = 4,
+ kPGPReverseKeyIDOrdering = 5,
+ kPGPValidityOrdering = 6,
+ kPGPReverseValidityOrdering = 7,
+ kPGPTrustOrdering = 8,
+ kPGPReverseTrustOrdering = 9,
+ kPGPEncryptKeySizeOrdering = 10,
+ kPGPReverseEncryptKeySizeOrdering = 11,
+ kPGPSigKeySizeOrdering = 12,
+ kPGPReverseSigKeySizeOrdering = 13,
+ kPGPCreationOrdering = 14,
+ kPGPReverseCreationOrdering = 15,
+ kPGPExpirationOrdering = 16,
+ kPGPReverseExpirationOrdering = 17,
+
+ PGP_ENUM_FORCE( PGPKeyOrdering_ )
+} ;
+PGPENUM_TYPEDEF( PGPKeyOrdering_, PGPKeyOrdering );
+
+
+
+/* Key properties */
+
+enum PGPKeyPropName_
+{
+/* String properties */
+ kPGPKeyPropFingerprint = 1,
+ kPGPKeyPropPreferredAlgorithms = 2,
+ kPGPKeyPropThirdPartyRevocationKeyID= 3,
+ kPGPKeyPropKeyData = 4,
+ kPGPKeyPropX509MD5Hash = 5,
+
+ /* Number properties */
+ kPGPKeyPropAlgID = 20,
+ kPGPKeyPropBits = 21,
+ kPGPKeyPropTrust = 22, /* old trust model only */
+ kPGPKeyPropValidity = 23, /* both trust models */
+ kPGPKeyPropLockingAlgID = 24,
+ kPGPKeyPropLockingBits = 25,
+ kPGPKeyPropFlags = 26,
+
+ /* Time properties */
+ kPGPKeyPropCreation = 40,
+ kPGPKeyPropExpiration = 41,
+ kPGPKeyPropCRLThisUpdate = 42,
+ kPGPKeyPropCRLNextUpdate = 43,
+
+ /* PGPBoolean properties */
+ kPGPKeyPropIsSecret = 60,
+ kPGPKeyPropIsAxiomatic = 61,
+ kPGPKeyPropIsRevoked = 62,
+ kPGPKeyPropIsDisabled = 63,
+ kPGPKeyPropIsNotCorrupt = 64,
+ kPGPKeyPropIsExpired = 65,
+ kPGPKeyPropNeedsPassphrase = 66,
+ kPGPKeyPropHasUnverifiedRevocation = 67,
+ kPGPKeyPropCanEncrypt = 68,
+ kPGPKeyPropCanDecrypt = 69,
+ kPGPKeyPropCanSign = 70,
+ kPGPKeyPropCanVerify = 71,
+ kPGPKeyPropIsEncryptionKey = 72,
+ kPGPKeyPropIsSigningKey = 73,
+ kPGPKeyPropIsSecretShared = 74,
+ kPGPKeyPropIsRevocable = 75,
+ kPGPKeyPropHasThirdPartyRevocation = 76,
+ kPGPKeyPropHasCRL = 77,
+
+ PGP_ENUM_FORCE( PGPKeyPropName_ )
+} ;
+PGPENUM_TYPEDEF( PGPKeyPropName_, PGPKeyPropName );
+
+
+/* kPGPKeyPropFlags bits */
+enum /* PGPKeyPropFlags */
+{
+ kPGPKeyPropFlags_UsageSignUserIDs = (1UL << 0 ),
+ kPGPKeyPropFlags_UsageSignMessages = (1UL << 1 ),
+ kPGPKeyPropFlags_UsageEncryptCommunications = (1UL << 2 ),
+ kPGPKeyPropFlags_UsageEncryptStorage = (1UL << 3 ),
+
+ kPGPKeyPropFlags_PrivateSplit = (1UL << 4 ),
+ kPGPKeyPropFlags_PrivateShared = (1UL << 7 )
+} ;
+typedef PGPFlags PGPKeyPropFlags;
+
+
+
+/* User ID properties */
+
+enum PGPUserIDPropName_
+{
+ /* String properties */
+ kPGPUserIDPropName = 80,
+ kPGPUserIDPropAttributeData = 81,
+ kPGPUserIDPropCommonName = 82,
+ kPGPUserIDPropEmailAddress = 83,
+
+ /* Number properties */
+ kPGPUserIDPropValidity = 100, /* both trust models */
+ kPGPUserIDPropConfidence = 101, /* new trust model only */
+ kPGPUserIDPropAttributeType = 102,
+
+ /* Time properties */
+
+ /* PGPBoolean properties */
+ kPGPUserIDPropIsAttribute = 110,
+
+ PGP_ENUM_FORCE( PGPUserIDPropName_ )
+} ;
+PGPENUM_TYPEDEF( PGPUserIDPropName_, PGPUserIDPropName );
+
+/* Signature properties */
+
+enum PGPSigPropName_
+{
+ /* String properties */
+ kPGPSigPropKeyID = 120,
+ kPGPSigPropX509Certificate = 121,
+ kPGPSigPropX509IASN = 122,
+ kPGPSigPropX509LongName = 123,
+ kPGPSigPropX509IssuerLongName = 124,
+ kPGPSigPropX509DNSName = 125,
+ kPGPSigPropX509IPAddress = 126,
+ kPGPSigPropX509DERDName = 127,
+
+ /* Number properties */
+ kPGPSigPropAlgID = 140,
+ kPGPSigPropTrustLevel = 141,
+ kPGPSigPropTrustValue = 142,
+
+ /* Time properties */
+ kPGPSigPropCreation = 160,
+ kPGPSigPropExpiration = 161,
+
+ /* PGPBoolean properties */
+ kPGPSigPropIsRevoked = 180,
+ kPGPSigPropIsNotCorrupt = 181,
+ kPGPSigPropIsTried = 182,
+ kPGPSigPropIsVerified = 183,
+ kPGPSigPropIsMySig = 184,
+ kPGPSigPropIsExportable = 185,
+ kPGPSigPropHasUnverifiedRevocation = 186,
+ kPGPSigPropIsExpired = 187,
+ kPGPSigPropIsX509 = 188,
+
+ PGP_ENUM_FORCE( PGPSigPropName_ )
+} ;
+PGPENUM_TYPEDEF( PGPSigPropName_, PGPSigPropName );
+/*
+ * Note on kPGPSigPropIsMySig. This is a convenience property for
+ * determining whether the certification was made by one of the
+ * caller's own private keys. This can only return true if the
+ * signing key is in the same base keyset as the certification. If the
+ * signing key is( suspected to be) in a different base keyset, call
+ * PGPGetSigCertifierKey( certset, signerset, &key) followed by
+ * PGPGetKeyBoolean( key, kPGPKeyPropIsSecret, &secret).
+ */
+
+
+/* Attribute types, for use with kPGPUserIDPropAttributeType */
+enum PGPAttributeType_
+{
+ kPGPAttribute_Image = 1,
+ kPGPAttribute_IPAddress = 10,
+ kPGPAttribute_DNSName = 11,
+ kPGPAttribute_Notation = 20,
+
+ PGP_ENUM_FORCE( PGPAttributeType_ )
+} ;
+PGPENUM_TYPEDEF( PGPAttributeType_, PGPAttributeType );
+
+
+enum /* PGPKeyRingOpenFlags */
+{
+ kPGPKeyRingOpenFlags_None = 0,
+ kPGPKeyRingOpenFlags_Reserved = (1UL << 0 ),
+ kPGPKeyRingOpenFlags_Mutable = (1UL << 1 ),
+ kPGPKeyRingOpenFlags_Create = (1UL << 2 ),
+
+ /* The following flags are only used by PGPOpenKeyRing */
+ kPGPKeyRingOpenFlags_Private = (1UL << 8 ),
+ kPGPKeyRingOpenFlags_Trusted = (1UL << 9 )
+} ;
+typedef PGPFlags PGPKeyRingOpenFlags;
+
+/*
+ * Used by filtering functions to specify type of match.
+ */
+
+enum PGPMatchCriterion_
+{
+ kPGPMatchDefault = 1,
+ kPGPMatchEqual = 1, /* searched val == supplied val */
+ kPGPMatchGreaterOrEqual = 2, /* searched val >= supplied val */
+ kPGPMatchLessOrEqual = 3, /* searched val <= supplied val */
+ kPGPMatchSubString = 4, /* searched val is contained in supplied val */
+
+ PGP_ENUM_FORCE( PGPMatchCriterion_ )
+} ;
+PGPENUM_TYPEDEF( PGPMatchCriterion_, PGPMatchCriterion );
+
+
+/* This is the value of the expiration time which means "never expires" */
+#define kPGPExpirationTime_Never ( (PGPTime)0 )
+
+/* Secret sharing header size */
+#define kPGPShareHeaderSize 4
+
+/* Public entry points */
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+/* Functions for setting up key filters. */
+
+PGPError PGPIncFilterRefCount ( PGPFilterRef filter );
+
+PGPError PGPFreeFilter ( PGPFilterRef filter );
+
+PGPError PGPNewKeyIDFilter( PGPContextRef context,
+ PGPKeyID const * keyID, PGPFilterRef *outFilter);
+
+PGPError PGPNewSubKeyIDFilter( PGPContextRef context,
+ PGPKeyID const * subKeyID,
+ PGPFilterRef * outFilter);
+
+PGPError PGPNewKeyEncryptAlgorithmFilter( PGPContextRef context,
+ PGPPublicKeyAlgorithm encryptAlgorithm,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyFingerPrintFilter( PGPContextRef context,
+ void const *fingerPrint,
+ PGPSize fingerPrintLength, PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyCreationTimeFilter( PGPContextRef context,
+ PGPTime creationTime, PGPMatchCriterion match,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyExpirationTimeFilter( PGPContextRef context,
+ PGPTime expirationTime,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyRevokedFilter( PGPContextRef context,
+ PGPBoolean revoked, PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyDisabledFilter( PGPContextRef context,
+ PGPBoolean disabled,
+ PGPFilterRef * outFilter);
+
+PGPError PGPNewKeySigAlgorithmFilter( PGPContextRef context,
+ PGPPublicKeyAlgorithm sigAlgorithm,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyEncryptKeySizeFilter( PGPContextRef context,
+ PGPUInt32 keySize, PGPMatchCriterion match,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewKeySigKeySizeFilter( PGPContextRef context,
+ PGPUInt32 keySize, PGPMatchCriterion match,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewUserIDStringFilter( PGPContextRef context,
+ char const * userIDString,
+ PGPMatchCriterion match,
+ PGPFilterRef * outFilter);
+
+PGPError PGPNewUserIDEmailFilter( PGPContextRef context,
+ char const * emailString,
+ PGPMatchCriterion match,
+ PGPFilterRef * outFilter);
+
+PGPError PGPNewUserIDNameFilter( PGPContextRef context,
+ char const * nameString,
+ PGPMatchCriterion match,
+ PGPFilterRef * outFilter);
+
+PGPError PGPNewSigKeyIDFilter( PGPContextRef context,
+ PGPKeyID const * keyID,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyBooleanFilter( PGPContextRef context,
+ PGPKeyPropName property, PGPBoolean match,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyNumberFilter( PGPContextRef context,
+ PGPKeyPropName property, PGPUInt32 value,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyTimeFilter( PGPContextRef context,
+ PGPKeyPropName property, PGPTime value,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewKeyPropertyBufferFilter( PGPContextRef context,
+ PGPKeyPropName property, void *buffer, PGPSize length,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewSubKeyBooleanFilter( PGPContextRef context,
+ PGPKeyPropName property, PGPBoolean match,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewSubKeyNumberFilter( PGPContextRef context,
+ PGPKeyPropName property, PGPUInt32 value,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewSubKeyTimeFilter( PGPContextRef context,
+ PGPKeyPropName property, PGPTime value,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewSubKeyPropertyBufferFilter( PGPContextRef context,
+ PGPKeyPropName property, void *buffer, PGPSize length,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewUserIDBooleanFilter( PGPContextRef context,
+ PGPUserIDPropName property, PGPBoolean match,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewUserIDNumberFilter( PGPContextRef context,
+ PGPUserIDPropName property, PGPUInt32 value,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewUserIDStringBufferFilter( PGPContextRef context,
+ PGPUserIDPropName property,
+ void *buffer, PGPSize length,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewSigBooleanFilter( PGPContextRef context,
+ PGPSigPropName property, PGPBoolean match,
+ PGPFilterRef *outFilter );
+
+PGPError PGPNewSigNumberFilter( PGPContextRef context,
+ PGPSigPropName property, PGPUInt32 value,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewSigTimeFilter( PGPContextRef context,
+ PGPSigPropName property, PGPTime value,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+PGPError PGPNewSigPropertyBufferFilter( PGPContextRef context,
+ PGPSigPropName property, void *buffer, PGPSize length,
+ PGPMatchCriterion match, PGPFilterRef *outFilter );
+
+/* freeing outfilter will call PGPFreeFilter on filter */
+PGPError PGPNegateFilter( PGPFilterRef filter,
+ PGPFilterRef *outFilter);
+
+/* freeing outfilter will call PGPFreeFilter on filter1, filter2 */
+PGPError PGPIntersectFilters( PGPFilterRef filter1,
+ PGPFilterRef filter2, PGPFilterRef *outFilter);
+
+/* freeing outfilter will call PGPFreeFilter on filter1, filter2 */
+PGPError PGPUnionFilters( PGPFilterRef filter1,
+ PGPFilterRef filter2, PGPFilterRef *outFilter);
+
+
+PGPError PGPFilterKeySet( PGPKeySetRef origSet,
+ PGPFilterRef filter, PGPKeySetRef *resultSet);
+
+
+/* Keyserver filter functions */
+
+PGPError PGPLDAPQueryFromFilter( PGPFilterRef filter,
+ char **queryOut );
+
+PGPError PGPHKSQueryFromFilter( PGPFilterRef filter,
+ char **queryOut );
+
+PGPError PGPNetToolsCAHTTPQueryFromFilter( PGPFilterRef filter,
+ char **queryOut );
+
+/* KeySet manipulations */
+
+
+/* Creates a new memory-based KeyDB and returns its root set */
+PGPError PGPNewKeySet(PGPContextRef context, PGPKeySetRef *keySet);
+
+
+/* Used for building arbitrary subsets of an existing KeyDB */
+PGPError PGPNewEmptyKeySet(PGPKeySetRef origSet, PGPKeySetRef *newSet);
+PGPError PGPNewSingletonKeySet(PGPKeyRef key, PGPKeySetRef *keySet);
+PGPError PGPUnionKeySets(PGPKeySetRef set1, PGPKeySetRef set2,
+ PGPKeySetRef *newSet);
+
+PGPError PGPOpenDefaultKeyRings( PGPContextRef context,
+ PGPKeyRingOpenFlags openFlags, PGPKeySetRef *keySet);
+
+PGPError PGPOpenKeyRingPair( PGPContextRef context,
+ PGPKeyRingOpenFlags openFlags,
+ PGPFileSpecRef pubFileRef, PGPFileSpecRef secFileRef,
+ PGPKeySetRef *keySet);
+
+PGPError PGPOpenKeyRing (PGPContextRef context,
+ PGPKeyRingOpenFlags openFlags, PGPFileSpecRef fileRef,
+ PGPKeySetRef *keySet);
+
+PGPError PGPCommitKeyRingChanges (PGPKeySetRef keys);
+
+PGPError PGPPropagateTrust (PGPKeySetRef keys);
+
+PGPError PGPRevertKeyRingChanges (PGPKeySetRef keys);
+
+PGPError PGPCheckKeyRingSigs (PGPKeySetRef keysToCheck,
+ PGPKeySetRef keysSigning, PGPBoolean checkAll,
+ PGPEventHandlerProcPtr eventHandler,
+ PGPUserValue eventHandlerData);
+
+PGPError PGPReloadKeyRings (PGPKeySetRef keys);
+
+PGPError PGPGetKeyByKeyID (PGPKeySetRef keys,
+ PGPKeyID const * keyID,
+ PGPPublicKeyAlgorithm pubKeyAlgorithm,
+ PGPKeyRef *outRef);
+
+PGPBoolean PGPKeySetIsMember(PGPKeyRef key, PGPKeySetRef set);
+
+PGPError PGPCountKeys( PGPKeySetRef keys, PGPUInt32 *numKeys);
+
+PGPError PGPIncKeySetRefCount( PGPKeySetRef keys);
+
+PGPError PGPFreeKeySet( PGPKeySetRef keys);
+
+PGPBoolean PGPKeySetIsMutable( PGPKeySetRef keys);
+
+PGPBoolean PGPKeySetNeedsCommit( PGPKeySetRef keys);
+
+
+PGPError PGPAddKeys( PGPKeySetRef keysToAdd, PGPKeySetRef set );
+
+PGPError PGPRemoveKeys( PGPKeySetRef keysToRemove, PGPKeySetRef set );
+
+
+
+/* Key manipulation functions */
+
+PGPError PGPDisableKey( PGPKeyRef key);
+
+PGPError PGPEnableKey( PGPKeyRef key);
+
+PGPError PGPRemoveSubKey( PGPSubKeyRef subkey);
+
+PGPError PGPRemoveUserID( PGPUserIDRef userID);
+
+PGPError PGPSetPrimaryUserID( PGPUserIDRef userid);
+
+PGPError PGPCertifyPrimaryUserID( PGPUserIDRef userid,
+ PGPOptionListRef firstOption, ...);
+
+PGPError PGPGetSigCertifierKey( PGPSigRef cert, PGPKeySetRef allkeys,
+ PGPKeyRef *certkey);
+
+PGPError PGPGetSigX509CertifierSig( PGPSigRef cert,
+ PGPKeySetRef allkeys, PGPSigRef *certsig);
+
+PGPError PGPRemoveSig( PGPSigRef cert);
+
+PGPError PGPCountAdditionalRecipientRequests( PGPKeyRef basekey,
+ PGPUInt32 * numARKeys);
+
+PGPError PGPGetIndexedAdditionalRecipientRequestKey(
+ PGPKeyRef basekey, PGPKeySetRef allkeys, PGPUInt32 nth,
+ PGPKeyRef *arkey, PGPKeyID *arkeyid,
+ PGPByte *arclass );
+
+PGPError PGPCountRevocationKeys( PGPKeyRef basekey,
+ PGPUInt32 * numRevKeys);
+
+PGPError PGPGetIndexedRevocationKey(
+ PGPKeyRef basekey, PGPKeySetRef allkeys, PGPUInt32 nth,
+ PGPKeyRef *revkey, PGPKeyID *revkeyid );
+PGPError PGPGetCRLDistributionPoints(
+ PGPKeyRef cakey, PGPKeySetRef keyset,
+ PGPUInt32 *pnDistPoints, PGPByte **pDpoints,
+ PGPSize **pdpointLengths );
+
+
+/* Wrapper functions */
+PGPError PGPGenerateKey( PGPContextRef context, PGPKeyRef *key,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPGenerateSubKey( PGPContextRef context,
+ PGPSubKeyRef *subkey,
+ PGPOptionListRef firstOption, ...);
+PGPUInt32 PGPGetKeyEntropyNeeded( PGPContextRef context,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPExportKeySet( PGPKeySetRef keys,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPExport( PGPContextRef context,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPImportKeySet( PGPContextRef context,
+ PGPKeySetRef *keys,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPSignUserID( PGPUserIDRef userID,
+ PGPKeyRef certifyingKey,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPAddUserID( PGPKeyRef key, char const *userID,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPAddAttributeUserID( PGPKeyRef key,
+ PGPAttributeType attributeType,
+ PGPByte *attributeData, PGPSize attributeLength,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPRevokeSig( PGPSigRef cert, PGPKeySetRef allkeys,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPRevokeKey( PGPKeyRef key,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPRevokeSubKey( PGPSubKeyRef subkey,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPChangePassphrase( PGPKeyRef key,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPChangeSubKeyPassphrase( PGPSubKeyRef subkey,
+ PGPOptionListRef firstOption, ...);
+PGPBoolean PGPPassphraseIsValid( PGPKeyRef key,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPSetKeyAxiomatic( PGPKeyRef key,
+ PGPOptionListRef firstOption, ...);
+
+
+
+/*
+ * Trust values for PGPSetKeyTrust and kPGPKeyPropTrust property:
+ *
+ * kPGPKeyTrust_Undefined (do not pass to PGPSetKeyTrust)
+ * kPGPKeyTrust_Unknown (unknown)
+ * kPGPKeyTrust_Never (never)
+ * kPGPKeyTrust_Marginal (sometimes)
+ * kPGPKeyTrust_Complete (always)
+ * kPGPKeyTrust_Ultimate (do not pass to PGPSetKeyTrust)
+ */
+
+ /* old trust model */
+PGPError PGPSetKeyTrust( PGPKeyRef key, PGPUInt32 trust);
+
+PGPError PGPUnsetKeyAxiomatic( PGPKeyRef key);
+
+/* Get property functions */
+
+PGPError PGPGetKeyBoolean( PGPKeyRef key, PGPKeyPropName propname,
+ PGPBoolean *prop);
+
+PGPError PGPGetKeyNumber( PGPKeyRef key, PGPKeyPropName propname,
+ PGPInt32 *prop);
+
+/* 'buffer' is NOT null-terminated */
+/* returns kPGPError_BufferTooSmall if buffer is too small, but
+fill buffer to capacity */
+PGPError PGPGetKeyPropertyBuffer( PGPKeyRef key,
+ PGPKeyPropName propname,
+ PGPSize bufferSize, void *data, PGPSize *fullSize);
+
+PGPError PGPGetKeyTime( PGPKeyRef key, PGPKeyPropName propname,
+ PGPTime *prop);
+
+PGPError PGPGetSubKeyBoolean( PGPSubKeyRef subkey,
+ PGPKeyPropName propname, PGPBoolean *prop);
+
+PGPError PGPGetSubKeyNumber( PGPSubKeyRef subkey,
+ PGPKeyPropName propname, PGPInt32 *prop);
+
+/* returns kPGPError_BufferTooSmall if buffer is too small, but
+fill buffer to capacity */
+PGPError PGPGetSubKeyPropertyBuffer( PGPSubKeyRef subkey,
+ PGPKeyPropName propname,
+ PGPSize bufferSize, void *prop, PGPSize *fullSize);
+
+PGPError PGPGetSubKeyTime( PGPSubKeyRef subkey,
+ PGPKeyPropName propname, PGPTime *prop);
+
+PGPError PGPGetUserIDNumber( PGPUserIDRef userID,
+ PGPUserIDPropName propname, PGPInt32 *prop);
+
+PGPError PGPGetUserIDBoolean( PGPUserIDRef userID,
+ PGPUserIDPropName propname, PGPBoolean *prop);
+
+/* 'string' is always NULL-terminated */
+/* returns kPGPError_BufferTooSmall if buffer is too small, but
+fill buffer to capacity */
+PGPError PGPGetUserIDStringBuffer( PGPUserIDRef userID,
+ PGPUserIDPropName propname,
+ PGPSize bufferSize,
+ char * string,
+ PGPSize * fullSize);
+
+/* 'buffer' is NOT null-terminated */
+/* returns kPGPError_BufferTooSmall if buffer is too small, but
+fill buffer to capacity */
+PGPError PGPGetSigPropertyBuffer( PGPSigRef cert,
+ PGPSigPropName propname,
+ PGPSize bufferSize, void *data, PGPSize *fullSize);
+
+PGPError PGPGetSigBoolean( PGPSigRef cert,
+ PGPSigPropName propname, PGPBoolean *prop);
+
+PGPError PGPGetSigNumber( PGPSigRef cert, PGPSigPropName propname,
+ PGPInt32 *prop);
+
+PGPError PGPGetKeyIDOfCertifier( PGPSigRef sig, PGPKeyID *outID );
+
+PGPError PGPGetSigTime( PGPSigRef cert, PGPSigPropName propname,
+ PGPTime *prop);
+
+PGPError PGPGetHashAlgUsed( PGPKeyRef key, PGPHashAlgorithm *hashAlg);
+
+/* Convenience property functions */
+
+PGPError PGPGetPrimaryUserID( PGPKeyRef key, PGPUserIDRef *outRef );
+PGPError PGPGetPrimaryAttributeUserID (PGPKeyRef key,
+ PGPAttributeType attributeType, PGPUserIDRef *outRef);
+
+/* 'string' is always a C string and
+ *fullSize includes the '\0' terminator */
+/* returns kPGPError_BufferTooSmall if buffer is too small, but
+fill buffer to capacity */
+PGPError PGPGetPrimaryUserIDNameBuffer( PGPKeyRef key,
+ PGPSize bufferSize,
+ char * string, PGPSize *fullSize );
+
+PGPError PGPGetPrimaryUserIDValidity(PGPKeyRef key,
+ PGPValidity *validity);
+
+
+PGPInt32 PGPCompareKeys(PGPKeyRef a, PGPKeyRef b,
+ PGPKeyOrdering order);
+
+PGPInt32 PGPCompareUserIDStrings(char const *a, char const *b);
+
+PGPError PGPOrderKeySet( PGPKeySetRef src,
+ PGPKeyOrdering order, PGPKeyListRef *outRef );
+
+PGPError PGPIncKeyListRefCount( PGPKeyListRef keys);
+
+PGPError PGPFreeKeyList( PGPKeyListRef keys);
+
+
+/* Key iteration functions */
+
+
+
+PGPError PGPNewKeyIter (PGPKeyListRef keys, PGPKeyIterRef *outRef);
+
+PGPError PGPCopyKeyIter (PGPKeyIterRef orig, PGPKeyIterRef *outRef);
+
+PGPError PGPFreeKeyIter (PGPKeyIterRef iter);
+
+PGPInt32 PGPKeyIterIndex (PGPKeyIterRef iter);
+
+PGPError PGPKeyIterRewind (PGPKeyIterRef iter);
+
+PGPInt32 PGPKeyIterSeek (PGPKeyIterRef iter, PGPKeyRef key);
+
+PGPError PGPKeyIterMove (PGPKeyIterRef iter, PGPInt32 relOffset,
+ PGPKeyRef *outRef);
+
+PGPError PGPKeyIterNext (PGPKeyIterRef iter, PGPKeyRef *outRef);
+
+PGPError PGPKeyIterPrev (PGPKeyIterRef iter, PGPKeyRef *outRef);
+
+PGPError PGPKeyIterKey (PGPKeyIterRef iter, PGPKeyRef *outRef);
+
+PGPError PGPKeyIterSubKey (PGPKeyIterRef iter,
+ PGPSubKeyRef *outRef );
+
+PGPError PGPKeyIterUserID (PGPKeyIterRef iter,
+ PGPUserIDRef *outRef );
+PGPError PGPKeyIterSig (PGPKeyIterRef iter,
+ PGPSigRef *outRef );
+
+PGPError PGPKeyIterNextSubKey (PGPKeyIterRef iter,
+ PGPSubKeyRef *outRef );
+
+PGPError PGPKeyIterPrevSubKey (PGPKeyIterRef iter,
+ PGPSubKeyRef *outRef);
+
+PGPError PGPKeyIterRewindSubKey (PGPKeyIterRef iter);
+
+PGPError PGPKeyIterNextUserID (PGPKeyIterRef iter,
+ PGPUserIDRef *outRef);
+
+PGPError PGPKeyIterPrevUserID (PGPKeyIterRef iter,
+ PGPUserIDRef *outRef);
+
+PGPError PGPKeyIterRewindUserID (PGPKeyIterRef iter);
+
+PGPError PGPKeyIterNextUIDSig (PGPKeyIterRef iter,
+ PGPSigRef *outRef);
+
+PGPError PGPKeyIterPrevUIDSig (PGPKeyIterRef iter,
+ PGPSigRef *outRef);
+
+PGPError PGPKeyIterRewindUIDSig (PGPKeyIterRef iter);
+
+
+/* Get/set default private key */
+
+PGPError PGPGetDefaultPrivateKey( PGPKeySetRef keyset,
+ PGPKeyRef *outRef );
+
+PGPError PGPSetDefaultPrivateKey( PGPKeyRef key);
+
+
+
+/* Get/set user value */
+
+PGPError PGPSetKeyUserVal( PGPKeyRef key, PGPUserValue userValue);
+
+PGPError PGPSetUserIDUserVal( PGPUserIDRef userid,
+ PGPUserValue userValue);
+
+PGPError PGPSetSubKeyUserVal( PGPSubKeyRef subkey,
+ PGPUserValue userValue);
+
+PGPError PGPSetSigUserVal( PGPSigRef cert,
+ PGPUserValue userValue);
+
+PGPError PGPGetKeyUserVal( PGPKeyRef key,
+ PGPUserValue *userValue);
+
+PGPError PGPGetUserIDUserVal( PGPUserIDRef userid,
+ PGPUserValue *userValue);
+
+PGPError PGPGetSubKeyUserVal( PGPSubKeyRef subkey,
+ PGPUserValue *userValue);
+
+PGPError PGPGetSigUserVal( PGPSigRef cert,
+ PGPUserValue *userValue);
+
+/* Passphrase conversion to passkeybuffer */
+/* The size of the output buffer is from the kPGPKeyPropLockingBits property */
+
+PGPError PGPGetKeyPasskeyBuffer ( PGPKeyRef key,
+ void *passkeyBuffer, PGPOptionListRef firstOption,...);
+
+PGPError PGPGetSubKeyPasskeyBuffer ( PGPSubKeyRef subkey,
+ void *passkeyBuffer, PGPOptionListRef firstOption,...);
+
+
+/* Change key options which are stored in self signatures internally */
+
+PGPError PGPAddKeyOptions( PGPKeyRef key,
+ PGPOptionListRef firstOption, ...);
+
+PGPError PGPRemoveKeyOptions( PGPKeyRef key,
+ PGPOptionListRef firstOption, ...);
+
+PGPError PGPUpdateKeyOptions( PGPKeyRef key,
+ PGPOptionListRef firstOption, ...);
+
+
+
+/*____________________________________________________________________________
+ Key IDs
+____________________________________________________________________________*/
+PGPError PGPGetKeyIDFromString(
+ const char *string, PGPKeyID *id );
+
+PGPError PGPGetKeyIDFromKey( PGPKeyRef key, PGPKeyID *id );
+
+PGPError PGPGetKeyIDFromSubKey( PGPSubKeyRef key, PGPKeyID * id );
+
+enum PGPKeyIDStringType_
+{
+ kPGPKeyIDString_Abbreviated = 2,
+ kPGPKeyIDString_Full = 3,
+ PGP_ENUM_FORCE( PGPKeyIDStringType_ )
+};
+PGPENUM_TYPEDEF( PGPKeyIDStringType_, PGPKeyIDStringType );
+
+
+#define kPGPMaxKeyIDStringSize ( 127 + 1 )
+PGPError PGPGetKeyIDString( PGPKeyID const * ref,
+ PGPKeyIDStringType type,
+ char outString[ kPGPMaxKeyIDStringSize ] );
+
+
+/* outputs opaque string of bytes for storage of maximum size as keyID*/
+/* do NOT attempt to parse the output; it is opaque to you */
+#define kPGPMaxExportedKeyIDSize ( sizeof( PGPKeyID ) )
+PGPError PGPExportKeyID( PGPKeyID const * keyID,
+ PGPByte exportedData[ kPGPMaxExportedKeyIDSize ],
+ PGPSize *exportedLength );
+
+/* must be in format output by PGPExportKeyID */
+PGPError PGPImportKeyID( void const * data, PGPKeyID * id );
+
+/* returns 0 if equal, -1 if key1 < key2, 1 if key1 > key2 */
+PGPInt32 PGPCompareKeyIDs( PGPKeyID const * key, PGPKeyID const * key2);
+
+
+
+
+/*____________________________________________________________________________
+ Getting contexts back from key related items. If the key is invalid,
+ you get kPGPInvalidRef back.
+____________________________________________________________________________*/
+
+PGPContextRef PGPGetKeyListContext( PGPKeyListRef ref );
+PGPContextRef PGPGetKeySetContext( PGPKeySetRef ref );
+PGPContextRef PGPGetKeyIterContext( PGPKeyIterRef ref );
+PGPContextRef PGPGetKeyContext( PGPKeyRef ref );
+PGPContextRef PGPGetSubKeyContext( PGPSubKeyRef ref );
+PGPContextRef PGPGetUserIDContext( PGPUserIDRef ref );
+
+/*____________________________________________________________________________
+ Getting parent objects from key related items. If the input is invalid,
+ you get kPGPInvalidRef back.
+____________________________________________________________________________*/
+PGPKeyRef PGPGetUserIDKey( PGPUserIDRef ref );
+PGPUserIDRef PGPGetSigUserID( PGPSigRef ref );
+PGPKeyRef PGPGetSigKey( PGPSigRef ref );
+
+
+/*____________________________________________________________________________
+ Secret sharing functionality
+____________________________________________________________________________*/
+
+PGPError PGPSecretShareData(PGPContextRef context,
+ void const * input, PGPSize inputBytes,
+ PGPUInt32 threshold, PGPUInt32 nShares, void * output);
+
+PGPError PGPSecretReconstructData(PGPContextRef context,
+ void * input, PGPSize outputBytes,
+ PGPUInt32 nShares, void * output);
+
+
+/*____________________________________________________________________________
+ X509 certificate specific
+____________________________________________________________________________*/
+
+PGPError PGPVerifyX509CertificateChain (PGPContextRef context,
+ PGPByte *certchain, PGPByte *rootcerts);
+
+PGPError PGPCreateDistinguishedName( PGPContextRef context,
+ char const *str,
+ PGPByte **pdname, PGPSize *pdnamelen );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+
+#endif /* ] Included_pgpKeys_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpMemoryMgr.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpMemoryMgr.h new file mode 100644 index 0000000000..7480d52b55 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpMemoryMgr.h @@ -0,0 +1,235 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ Contains the definition of the PGPMemoryMgr object.
+
+ $Id: pgpMemoryMgr.h,v 1.21 1999/05/07 01:55:45 heller Exp $
+____________________________________________________________________________*/
+
+#ifndef Included_pgpMemoryMgr_h /* [ */
+#define Included_pgpMemoryMgr_h
+
+
+#include "pgpBase.h"
+
+/*____________________________________________________________________________
+ Mini-tutorial:
+
+ A PGPMemoryMgr is an object which implements memory management, including
+ allocation, reallocation, deallocation, and secure versions of the same.
+
+ *** Using it ***
+ A typical sequence of calls is as follows:
+ PGPNewMemoryMgr
+ ...
+ PGPNewData or PGPNewSecureData
+ PGPFreeData
+ ...
+ PGPFreeMemoryMgr
+
+ Typically, a program will create one PGPMemoryMgr per thread at
+ thread creation time and use that memory mgr until the thread dies.
+ Generally, an individual PGPMemoryMgr instance is not thread-safe;
+ you must either synchronize or use one PGPMemoryMgr per thread.
+
+
+ *** Custom Allocators ***
+
+ Default allocators are supplied, but the client can create a custom
+ PGPMemoryMgr using PGPNewMemoryMgrCustom() which uses client-supplied
+ routines.
+ Custom routines need only concern themselves with the actual
+ allocation and deallocation.
+ The following should be kept in mind for user supplied routines:
+ - they can ignore the allocation flags passed
+ - leaks, memory clearing, etc is done by the PGPMemoryMgr
+ - secure allocator must set 'isNonPageable' to TRUE only if the
+ memory really can't be paged.
+ - the user value is not interpreted by the PGPMemoryMgr. Typically,
+ it would be a pointer to some data the allocation routines use
+ to store state.
+
+
+ *** Secure memory allocation ***
+
+ Blocks can be allocated as "Secure" blocks. Secure blocks are guaranteed
+ to be wiped when they are deallocated. Additionally, if the operating
+ system and the current conditions allow, the block will be allocated
+ in non-pageable memory. You can determine the attributes of a block using
+ PGPGetMemoryMgrDataInfo().
+
+
+ *** Leaks tracking ***
+
+ Leaks tracking is implemented when debugging is on,
+ but currently reporting is limited to reporting the number of leaks
+ outstanding when the PGPMemoryMgr is disposed.
+
+
+ *** Debugging ***
+
+ For debugging purposes, blocks may be larger in debug mode to accomodate
+ various schemes to detect stray pointers, etc.
+____________________________________________________________________________*/
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=mac68k
+#endif
+
+enum
+{
+ kPGPMemoryMgrFlags_None = 0,
+ kPGPMemoryMgrFlags_Clear = 1
+};
+
+typedef PGPFlags PGPMemoryMgrFlags;
+
+typedef struct PGPMemoryMgr PGPMemoryMgr;
+typedef PGPMemoryMgr * PGPMemoryMgrRef;
+
+#define kInvalidPGPMemoryMgrRef ((PGPMemoryMgrRef) NULL)
+#define PGPMemoryMgrRefIsValid(ref) ((ref) != kInvalidPGPMemoryMgrRef)
+
+typedef void *(*PGPMemoryMgrAllocationProc)( PGPMemoryMgrRef mgr,
+ PGPUserValue userValue,
+ PGPSize requestSize, PGPMemoryMgrFlags flags );
+
+/* realloc not be implemented using PGPNewData() */
+typedef PGPError (*PGPMemoryMgrReallocationProc)( PGPMemoryMgrRef mgr,
+ PGPUserValue userValue,
+ void **allocation, PGPSize newAllocationSize,
+ PGPMemoryMgrFlags flags, PGPSize existingSize );
+
+typedef PGPError (*PGPMemoryMgrDeallocationProc)( PGPMemoryMgrRef mgr,
+ PGPUserValue userValue,
+ void *allocation, PGPSize allocationSize );
+
+
+
+typedef void *(*PGPMemoryMgrSecureAllocationProc)( PGPMemoryMgrRef mgr,
+ PGPUserValue userValue,
+ PGPSize requestSize, PGPMemoryMgrFlags flags,
+ PGPBoolean *isNonPageable );
+
+
+/* deallocation proc need not clear the memory upon deallocation since
+ PGPFreeData() does it automatically */
+typedef PGPError (*PGPMemoryMgrSecureDeallocationProc)( PGPMemoryMgrRef mgr,
+ PGPUserValue userValue,
+ void *allocation, PGPSize allocationSize,
+ PGPBoolean wasLocked );
+
+
+typedef struct PGPNewMemoryMgrStruct
+{
+ /* sizeofStruct must be inited to sizeof( PGPNewMemoryMgrStruct ) */
+ PGPUInt32 sizeofStruct;
+ PGPFlags reservedFlags;
+
+ PGPMemoryMgrAllocationProc allocProc;
+ PGPMemoryMgrReallocationProc reallocProc;
+ PGPMemoryMgrDeallocationProc deallocProc;
+
+ PGPMemoryMgrSecureAllocationProc secureAllocProc;
+ void * reserved; /* MUST be zeroed */
+ PGPMemoryMgrSecureDeallocationProc secureDeallocProc;
+
+ PGPUserValue customValue;
+ void * pad[ 8 ]; /* MUST be zeroed */
+} PGPNewMemoryMgrStruct;
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+/*____________________________________________________________________________
+ Memory Mgr routines
+____________________________________________________________________________*/
+PGPBoolean PGPMemoryMgrIsValid( PGPMemoryMgrRef mgr );
+#define PGPValidateMemoryMgr( mgr ) \
+ PGPValidateParam( PGPMemoryMgrIsValid( mgr ) )
+
+PGPError PGPNewMemoryMgr( PGPFlags reserved,
+ PGPMemoryMgrRef *newMemoryMgr );
+
+PGPError PGPNewMemoryMgrCustom( PGPNewMemoryMgrStruct const * custom,
+ PGPMemoryMgrRef *newMemoryMgr );
+
+PGPError PGPFreeMemoryMgr( PGPMemoryMgrRef mgr );
+
+PGPError PGPGetMemoryMgrCustomValue( PGPMemoryMgrRef mgr,
+ PGPUserValue *customValue );
+PGPError PGPSetMemoryMgrCustomValue( PGPMemoryMgrRef mgr,
+ PGPUserValue customValue );
+
+/* allocate a block of the specified size */
+void * PGPNewData( PGPMemoryMgrRef mgr,
+ PGPSize requestSize, PGPMemoryMgrFlags flags );
+
+/* allocate a block of the specified size in non-pageable memory */
+/* *isSecure is TRUE if the block definitely can't be paged */
+void * PGPNewSecureData( PGPMemoryMgrRef mgr,
+ PGPSize requestSize, PGPMemoryMgrFlags flags );
+
+/* properly reallocs secure or non-secure blocks */
+/* WARNING: the block may move, even if its size is being reduced */
+PGPError PGPReallocData( PGPMemoryMgrRef mgr,
+ void **allocation, PGPSize newAllocationSize,
+ PGPMemoryMgrFlags flags );
+
+/* properly frees secure or non-secure blocks */
+PGPError PGPFreeData( void *allocation );
+
+
+/*____________________________________________________________________________
+ Block Info:
+ kPGPMemoryMgrBlockInfo_Valid it's a valid block
+ kPGPMemoryMgrBlockInfo_Secure block is a secure allocation
+ kPGPMemoryMgrBlockInfo_NonPageable block cannot be paged by VM
+
+ Secure blocks are always wiped before being disposed,
+ but may or may not be pageable, depending on the OS facilities. Some
+ OSs may not provide the ability to make blocks non-pageable.
+
+ You should check these flags if the information matters to you.
+____________________________________________________________________________*/
+#define kPGPMemoryMgrBlockInfo_Valid ( ((PGPFlags)1) << 0 )
+#define kPGPMemoryMgrBlockInfo_Secure ( ((PGPFlags)1) << 1 )
+#define kPGPMemoryMgrBlockInfo_NonPageable ( ((PGPFlags)1) << 2 )
+PGPFlags PGPGetMemoryMgrDataInfo( void *allocation );
+
+
+/*____________________________________________________________________________
+ Default memory manager routines:
+____________________________________________________________________________*/
+
+PGPMemoryMgrRef PGPGetDefaultMemoryMgr(void);
+PGPError PGPSetDefaultMemoryMgr(PGPMemoryMgrRef memoryMgr);
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=reset
+#endif
+
+
+#endif /* ] Included_pgpMemoryMgr_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpOptionList.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpOptionList.h new file mode 100644 index 0000000000..7ccbc8e1b7 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpOptionList.h @@ -0,0 +1,452 @@ +/*____________________________________________________________________________
+ pgpOptionList.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ This file contains the types and prototypes for functions which manipulate
+ PGPOptionList data structures.
+
+ $Id: pgpOptionList.h,v 1.35 1999/05/07 23:47:46 hal Exp $
+____________________________________________________________________________*/
+
+#ifndef Included_pgpOptionList_h /* [ */
+#define Included_pgpOptionList_h
+
+#include <stdarg.h>
+
+#include "pgpPubTypes.h"
+
+#if PGP_MACINTOSH
+#include <Files.h>
+#endif
+
+/* Standard event callback declaration */
+struct PGPEvent;
+typedef PGPError (*PGPEventHandlerProcPtr)(PGPContextRef context,
+ struct PGPEvent *event, PGPUserValue userValue);
+
+/* Export formats for exporting functions */
+enum PGPExportFormat_
+{
+ kPGPExportFormat_Basic = 1,
+ kPGPExportFormat_Complete = 255,
+
+ kPGPExportFormat_X509Cert = 10000,
+
+ kPGPExportFormat_X509CertReq = 11000,
+ kPGPExportFormat_NetToolsCAV1_CertReq,
+ kPGPExportFormat_VerisignV1_CertReq,
+ kPGPExportFormat_EntrustV1_CertReq,
+
+ /* Deprecated aliases for three above */
+/* kPGPExportFormat_NetToolsCAV1 = 11001,
+ kPGPExportFormat_VerisignV1,
+ kPGPExportFormat_EntrustV1,
+*/
+ kPGPExportFormat_X509GetCertInitial = 11010,
+ kPGPExportFormat_NetToolsCAV1_GetCertInitial,
+ kPGPExportFormat_VerisignV1_GetCertInitial,
+ kPGPExportFormat_EntrustV1_GetCertInitial,
+
+ kPGPExportFormat_X509GetCRL = 11020,
+ kPGPExportFormat_NetToolsCAV1_GetCRL,
+ kPGPExportFormat_VerisignV1_GetCRL,
+ kPGPExportFormat_EntrustV1_GetCRL,
+
+ PGP_ENUM_FORCE( PGPExportFormat_ )
+} ;
+PGPENUM_TYPEDEF( PGPExportFormat_, PGPExportFormat );
+
+/* Input formats for PGPOInputFormat */
+enum PGPInputFormat_
+{
+ kPGPInputFormat_Unknown = 0,
+ kPGPInputFormat_PGP = 1,
+
+ kPGPInputFormat_X509DataInPKCS7 = 10000,
+ kPGPInputFormat_NetToolsCAV1_DataInPKCS7,
+ kPGPInputFormat_VerisignV1_DataInPKCS7,
+ kPGPInputFormat_EntrustV1_DataInPKCS7,
+
+ /* Deprecated aliases for three above */
+/* kPGPInputFormat_NetToolsCAV1 = 10001,
+ kPGPInputFormat_VerisignV1,
+ kPGPInputFormat_EntrustV1,
+*/
+ kPGPInputFormat_PEMEncodedX509Cert,
+ kPGPInputFormat_NetToolsCAV1_PEMEncoded,
+ kPGPInputFormat_VerisignV1_PEMEncoded,
+ kPGPInputFormat_EntrustV1_PEMEncoded,
+
+ /* Input formats for X.509 private keys */
+ kPGPInputFormat_PrivateKeyInfo,
+ kPGPInputFormat_PKCS12,
+
+ PGP_ENUM_FORCE( PGPInputFormat_ )
+} ;
+PGPENUM_TYPEDEF( PGPInputFormat_, PGPInputFormat );
+
+/* Output formats for PGPOOutputFormat */
+enum PGPOutputFormat_
+{
+ kPGPOutputFormat_Unknown = 0,
+ kPGPOutputFormat_PGP = 1,
+
+ kPGPOutputFormat_X509CertReqInPKCS7 = 10000,
+ kPGPOutputFormat_NetToolsCAV1_CertReqInPKCS7,
+ kPGPOutputFormat_VerisignV1_CertReqInPKCS7,
+ kPGPOutputFormat_EntrustV1_CertReqInPKCS7,
+
+ /* Deprecated aliases for above three */
+/* kPGPOutputFormat_NetToolsCAV1 = 10001,
+ kPGPOutputFormat_VerisignV1,
+ kPGPOutputFormat_EntrustV1,
+*/
+ kPGPOutputFormat_X509GetCertInitialInPKCS7 = 10010,
+ kPGPOutputFormat_NetToolsCAV1_GetCertInitialInPKCS7,
+ kPGPOutputFormat_VerisignV1_GetCertInitialInPKCS7,
+ kPGPOutputFormat_EntrustV1_GetCertInitialInPKCS7,
+
+ kPGPOutputFormat_X509GetCRLInPKCS7 = 10020,
+ kPGPOutputFormat_NetToolsCAV1_GetCRLInPKCS7,
+ kPGPOutputFormat_VerisignV1_GetCRLInPKCS7,
+ kPGPOutputFormat_EntrustV1_GetCRLInPKCS7,
+
+ PGP_ENUM_FORCE( PGPOutputFormat_ )
+} ;
+PGPENUM_TYPEDEF( PGPOutputFormat_, PGPOutputFormat );
+
+/* Attribute-Value structure for PGPOAttributeValue */
+enum PGPAVAttribute_
+{
+ /* Pointer properties */
+ kPGPAVAttributeFirstPointer = 0,
+ kPGPAVAttribute_CommonName = kPGPAVAttributeFirstPointer,
+ kPGPAVAttribute_Email,
+ kPGPAVAttribute_OrganizationName,
+ kPGPAVAttribute_OrganizationalUnitName,
+ kPGPAVAttribute_SurName,
+ kPGPAVAttribute_SerialNumber,
+ kPGPAVAttribute_Country,
+ kPGPAVAttribute_Locality,
+ kPGPAVAttribute_State,
+ kPGPAVAttribute_StreetAddress,
+ kPGPAVAttribute_Title,
+ kPGPAVAttribute_Description,
+ kPGPAVAttribute_PostalCode,
+ kPGPAVAttribute_POBOX,
+ kPGPAVAttribute_PhysicalDeliveryOfficeName,
+ kPGPAVAttribute_TelephoneNumber,
+ kPGPAVAttribute_X121Address,
+ kPGPAVAttribute_ISDN,
+ kPGPAVAttribute_DestinationIndicator,
+ kPGPAVAttribute_Name,
+ kPGPAVAttribute_GivenName,
+ kPGPAVAttribute_Initials,
+ kPGPAVAttribute_HouseIdentifier,
+ kPGPAVAttribute_DirectoryManagementDomain,
+ kPGPAVAttribute_DomainComponent,
+ kPGPAVAttribute_UnstructuredName,
+ kPGPAVAttribute_UnstructuredAddress,
+ kPGPAVAttribute_RFC822Name,
+ kPGPAVAttribute_DNSName,
+ kPGPAVAttribute_AnotherName,
+ kPGPAVAttribute_IPAddress,
+ kPGPAVAttribute_CertificateExtension,
+
+ /* Verisign specific */
+ kPGPAVAttribute_Challenge,
+ kPGPAVAttribute_CertType,
+ kPGPAVAttribute_MailFirstName,
+ kPGPAVAttribute_MailMiddleName,
+ kPGPAVAttribute_MailLastName,
+ kPGPAVAttribute_EmployeeID,
+ kPGPAVAttribute_MailStop,
+ kPGPAVAttribute_AdditionalField4,
+ kPGPAVAttribute_AdditionalField5,
+ kPGPAVAttribute_AdditionalField6,
+ kPGPAVAttribute_Authenticate,
+
+
+ /* Boolean properties */
+ kPGPAVAttributeFirstBoolean = 1000,
+
+ /* Verisign specific */
+ kPGPAVAttribute_EmbedEmail,
+
+
+ /* Numeric (PGPUInt32) properties */
+ kPGPAVAttributeFirstNumber = 2000,
+
+ PGP_ENUM_FORCE( PGPAVAttribute_ )
+} ;
+PGPENUM_TYPEDEF( PGPAVAttribute_, PGPAVAttribute );
+
+typedef struct PGPAttributeValue {
+ PGPAVAttribute attribute;
+ PGPSize size;
+ union {
+ PGPBoolean booleanvalue;
+ PGPUInt32 longvalue;
+ void *pointervalue;
+ } value;
+ PGPUInt32 unused;
+} PGPAttributeValue ;
+
+
+
+PGP_BEGIN_C_DECLARATIONS
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+PGPError PGPNewOptionList(PGPContextRef context,
+ PGPOptionListRef *outList);
+PGPError PGPAppendOptionList(PGPOptionListRef optionList,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPBuildOptionList( PGPContextRef context,
+ PGPOptionListRef *outList,
+ PGPOptionListRef firstOption, ...);
+PGPError PGPCopyOptionList(PGPOptionListRef optionList,
+ PGPOptionListRef *outList );
+PGPError PGPFreeOptionList(PGPOptionListRef optionList);
+
+/*
+** The following functions are used to create PGPOptionListRef's for
+** specifying the various options to several SDK functions. The
+** functions can be used as inline parameters in a temporary manner or
+** used with PGPBuildOptionList() to create persistent lists.
+*/
+
+/*
+** Special PGPOptionListRef to mark last option passed to those functions
+** which take variable lists of PGPOptionListRef's:
+*/
+
+PGPOptionListRef PGPOLastOption( PGPContextRef context );
+
+/*
+** Special PGPOptionListRef which is always ignored:
+*/
+
+PGPOptionListRef PGPONullOption( PGPContextRef context);
+
+/* Data input (required): */
+
+PGPOptionListRef PGPOInputFile( PGPContextRef context,
+ PGPFileSpecRef fileRef);
+PGPOptionListRef PGPOInputBuffer( PGPContextRef context,
+ void const *buffer, PGPSize bufferSize);
+#if PGP_MACINTOSH
+PGPOptionListRef PGPOInputFileFSSpec( PGPContextRef context,
+ const FSSpec *fileSpec);
+#endif
+
+/* Data output (optional, generates event if missing): */
+
+PGPOptionListRef PGPOOutputFile( PGPContextRef context,
+ PGPFileSpecRef fileRef);
+PGPOptionListRef PGPOOutputBuffer( PGPContextRef context,
+ void *buffer, PGPSize bufferSize,
+ PGPSize *outputDataLength);
+#if PGP_MACINTOSH
+PGPOptionListRef PGPOOutputFileFSSpec( PGPContextRef context,
+ const FSSpec *fileSpec);
+#endif
+
+/* '*buffer' must be disposed of via PGPFreeData() */
+/* maximum memory usage will be no more than maximumBufferSize */
+PGPOptionListRef PGPOAllocatedOutputBuffer(PGPContextRef context,
+ void **buffer,
+ PGPSize maximumBufferSize,
+ PGPSize *actualBufferSize);
+PGPOptionListRef PGPOAppendOutput( PGPContextRef context,
+ PGPBoolean appendOutput );
+PGPOptionListRef PGPODiscardOutput( PGPContextRef context,
+ PGPBoolean discardOutput );
+
+/* Encrypting and signing */
+
+PGPOptionListRef PGPOEncryptToKey( PGPContextRef context,
+ PGPKeyRef keyRef);
+PGPOptionListRef PGPOEncryptToKeySet( PGPContextRef context,
+ PGPKeySetRef keySetRef);
+PGPOptionListRef PGPOEncryptToUserID( PGPContextRef context,
+ PGPUserIDRef userIDRef);
+PGPOptionListRef PGPOSignWithKey( PGPContextRef context,
+ PGPKeyRef keyRef,
+ PGPOptionListRef firstOption, ...);
+PGPOptionListRef PGPOConventionalEncrypt( PGPContextRef context,
+ PGPOptionListRef firstOption,
+ ...);
+
+PGPOptionListRef PGPOPassphraseBuffer( PGPContextRef context,
+ const void *passphrase, PGPSize passphraseLength);
+PGPOptionListRef PGPOPassphrase( PGPContextRef context,
+ const char *passphrase);
+PGPOptionListRef PGPOPasskeyBuffer( PGPContextRef context,
+ const void *passkey, PGPSize passkeyLength);
+PGPOptionListRef PGPOSessionKey( PGPContextRef context,
+ const void *sessionKey, PGPSize sessionKeyLength);
+PGPOptionListRef PGPOAskUserForEntropy( PGPContextRef context,
+ PGPBoolean askUserForEntropy );
+PGPOptionListRef PGPORawPGPInput( PGPContextRef context,
+ PGPBoolean rawPGPInput );
+PGPOptionListRef PGPOCompression( PGPContextRef context,
+ PGPBoolean compression );
+
+PGPOptionListRef PGPOLocalEncoding( PGPContextRef context,
+ PGPLocalEncodingFlags localEncode);
+PGPOptionListRef PGPOOutputLineEndType(PGPContextRef context,
+ PGPLineEndType lineEnd);
+PGPOptionListRef PGPOPGPMIMEEncoding(PGPContextRef context,
+ PGPBoolean mimeEncoding, PGPSize *mimeBodyOffset,
+ char mimeSeparator[ kPGPMimeSeparatorSize ]);
+PGPOptionListRef PGPOOmitMIMEVersion( PGPContextRef context,
+ PGPBoolean omitVersion);
+PGPOptionListRef PGPOX509Encoding( PGPContextRef context,
+ PGPBoolean x509Encoding);
+
+PGPOptionListRef PGPODetachedSig( PGPContextRef context,
+ PGPOptionListRef firstOption,
+ ...);
+
+PGPOptionListRef PGPOCipherAlgorithm( PGPContextRef context,
+ PGPCipherAlgorithm algorithm);
+PGPOptionListRef PGPOHashAlgorithm( PGPContextRef context,
+ PGPHashAlgorithm algorithm);
+
+PGPOptionListRef PGPOFailBelowValidity( PGPContextRef context,
+ PGPValidity minValidity);
+PGPOptionListRef PGPOWarnBelowValidity( PGPContextRef context,
+ PGPValidity minValidity);
+
+
+PGPOptionListRef PGPOEventHandler( PGPContextRef context,
+ PGPEventHandlerProcPtr eventHandler,
+ PGPUserValue eventHandlerData);
+PGPOptionListRef PGPOSendNullEvents( PGPContextRef context,
+ PGPTimeInterval approxInterval);
+
+PGPOptionListRef PGPOArmorOutput( PGPContextRef context,
+ PGPBoolean armorOutput );
+PGPOptionListRef PGPODataIsASCII( PGPContextRef context,
+ PGPBoolean dataIsASCII );
+PGPOptionListRef PGPOClearSign( PGPContextRef context,
+ PGPBoolean clearSign );
+PGPOptionListRef PGPOForYourEyesOnly( PGPContextRef context,
+ PGPBoolean forYourEyesOnly );
+PGPOptionListRef PGPOKeySetRef( PGPContextRef context,
+ PGPKeySetRef keysetRef);
+
+PGPOptionListRef PGPOExportKeySet( PGPContextRef context,
+ PGPKeySetRef keysetRef);
+PGPOptionListRef PGPOExportKey( PGPContextRef context,
+ PGPKeyRef keyRef);
+PGPOptionListRef PGPOExportUserID( PGPContextRef context,
+ PGPUserIDRef useridRef);
+PGPOptionListRef PGPOExportSig( PGPContextRef context,
+ PGPSigRef sigRef);
+
+PGPOptionListRef PGPOImportKeysTo( PGPContextRef context,
+ PGPKeySetRef keysetRef);
+PGPOptionListRef PGPOSendEventIfKeyFound( PGPContextRef context,
+ PGPBoolean sendEventIfKeyFound );
+PGPOptionListRef PGPOPassThroughIfUnrecognized( PGPContextRef context,
+ PGPBoolean passThroughIfUnrecognized );
+PGPOptionListRef PGPOPassThroughClearSigned( PGPContextRef context,
+ PGPBoolean passThroughClearSigned );
+PGPOptionListRef PGPOPassThroughKeys( PGPContextRef context,
+ PGPBoolean passThroughKeys );
+PGPOptionListRef PGPORecursivelyDecode( PGPContextRef context,
+ PGPBoolean recurse );
+
+PGPOptionListRef PGPOKeyGenParams( PGPContextRef context,
+ PGPPublicKeyAlgorithm pubKeyAlg,
+ PGPUInt32 bits);
+
+PGPOptionListRef PGPOKeyGenName( PGPContextRef context,
+ const void *name, PGPSize nameLength);
+
+PGPOptionListRef PGPOCreationDate( PGPContextRef context,
+ PGPTime creationDate);
+PGPOptionListRef PGPOExpiration( PGPContextRef context,
+ PGPUInt32 expirationDays);
+
+PGPOptionListRef PGPOAdditionalRecipientRequestKeySet(
+ PGPContextRef context,
+ PGPKeySetRef arKeySetRef, PGPByte arkClass);
+
+PGPOptionListRef PGPORevocationKeySet(PGPContextRef context,
+ PGPKeySetRef raKeySetRef);
+
+PGPOptionListRef PGPOKeyGenMasterKey( PGPContextRef context,
+ PGPKeyRef masterKeyRef);
+
+PGPOptionListRef PGPOPreferredAlgorithms(
+ PGPContextRef context,
+ PGPCipherAlgorithm const *prefAlg,
+ PGPUInt32 numAlgs);
+
+PGPOptionListRef PGPOKeyGenFast( PGPContextRef context,
+ PGPBoolean fastGen);
+
+PGPOptionListRef PGPOKeyGenUseExistingEntropy( PGPContextRef context,
+ PGPBoolean useExistingEntropy);
+
+PGPOptionListRef PGPOCommentString( PGPContextRef context,
+ char const *comment);
+
+PGPOptionListRef PGPOVersionString( PGPContextRef context,
+ char const *version);
+
+PGPOptionListRef PGPOFileNameString( PGPContextRef context,
+ char const *fileName);
+
+PGPOptionListRef PGPOSigRegularExpression(PGPContextRef context,
+ char const *regularExpression);
+
+PGPOptionListRef PGPOExportPrivateKeys( PGPContextRef context,
+ PGPBoolean exportKeys);
+
+PGPOptionListRef PGPOExportPrivateSubkeys( PGPContextRef context,
+ PGPBoolean exportSubkeys);
+
+PGPOptionListRef PGPOExportFormat(PGPContextRef context,
+ PGPExportFormat exportFormat);
+
+PGPOptionListRef PGPOExportable( PGPContextRef context,
+ PGPBoolean exportable);
+
+PGPOptionListRef PGPOSigTrust( PGPContextRef context,
+ PGPUInt32 trustLevel,
+ PGPUInt32 trustValue);
+
+PGPOptionListRef PGPOInputFormat( PGPContextRef context,
+ PGPInputFormat inputFormat );
+
+PGPOptionListRef PGPOOutputFormat( PGPContextRef context,
+ PGPOutputFormat outputFormat );
+
+PGPOptionListRef PGPOAttributeValue( PGPContextRef context,
+ PGPAttributeValue *attributeValue,
+ PGPUInt32 attributeValueCount);
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpOptionList_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPFLConfig.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPFLConfig.h new file mode 100644 index 0000000000..a5d7e67415 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPFLConfig.h @@ -0,0 +1,51 @@ +/*____________________________________________________________________________
+ pgpPFLConfig.h (Win32 version)
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ This file contains the Win32 version of the configuration file
+ normally generated by the automatic configure script on Unix.
+
+ $Id: pgpPFLConfig.h,v 1.8 1999/03/10 02:53:58 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpPFLConfig_h /* [ */
+#define Included_pgpPFLConfig_h
+
+#define HAVE_STDARG_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_UNISTD_H 0
+#define HAVE_USHORT 0
+#define HAVE_UINT 0
+#define HAVE_ULONG 0
+#define NO_LIMITS_H 0
+#define NO_POPEN 1
+
+#if defined( __MWERKS__ )
+
+ #define PGP_HAVE64 0
+
+
+#elif defined( _MSC_VER )
+ #define PGP_HAVE64 1
+ typedef __int64 PGPInt64;
+ typedef unsigned __int64 PGPUInt64;
+
+
+
+#endif
+
+
+
+
+#endif /* ] Included_pgpPFLConfig_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPFLErrors.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPFLErrors.h new file mode 100644 index 0000000000..ca35c79876 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPFLErrors.h @@ -0,0 +1,97 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ Error codes.
+
+ $Id: pgpPFLErrors.h,v 1.24.6.1 1999/06/13 20:27:13 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpPFLErrors_h /* [ */
+#define Included_pgpPFLErrors_h
+
+#include "pgpBase.h"
+
+#define kPGPPFLErrorBase -12000
+#define kPGPPFLErrorRange 500
+
+enum
+{
+ /*
+ NOTE: error numbers must not be changed as compile clients depend on them.
+ */
+
+ kPGPError_NoErr = 0,
+
+ kPGPError_BadParams = -12000,
+ kPGPError_OutOfMemory = -11999,
+ kPGPError_BufferTooSmall = -11998,
+
+ kPGPError_FileNotFound = -11997,
+ kPGPError_CantOpenFile = -11996,
+ kPGPError_FilePermissions = -11995,
+ kPGPError_FileLocked = -11994,
+ /* Was kPGPError_DiskFull = -11993, */
+ kPGPError_IllegalFileOp = -11992,
+ kPGPError_FileOpFailed = -11991,
+ kPGPError_ReadFailed = -11990,
+ kPGPError_WriteFailed = -11989,
+ kPGPError_EOF = -11988,
+
+ kPGPError_UserAbort = -11987,
+ kPGPError_UnknownRequest = -11986,
+ kPGPError_LazyProgrammer = -11985,
+ kPGPError_ItemNotFound = -11984,
+ kPGPError_ItemAlreadyExists = -11983,
+ kPGPError_AssertFailed = -11982,
+ kPGPError_BadMemAddress = -11981,
+ kPGPError_UnknownError = -11980,
+
+ kPGPError_PrefNotFound = -11979,
+ kPGPError_EndOfIteration = -11978,
+ kPGPError_ImproperInitialization = -11977,
+ kPGPError_CorruptData = -11976,
+ kPGPError_FeatureNotAvailable = -11975,
+
+ kPGPError_DiskFull = -11960,
+ kPGPError_DiskLocked = -11959,
+
+
+ kPGPError_LastPFLError = kPGPPFLErrorBase + kPGPPFLErrorRange - 1
+};
+
+#define IsPGPError( err ) ( (err) != kPGPError_NoErr )
+#define IsntPGPError( err ) ( (err) == kPGPError_NoErr )
+
+
+
+#define PGPValidateParam( expr ) \
+ if ( ! (expr ) ) \
+ {\
+ return( kPGPError_BadParams );\
+ }
+
+#define PGPValidatePtr( ptr ) \
+ PGPValidateParam( (ptr) != NULL )
+
+
+PGP_BEGIN_C_DECLARATIONS
+
+
+PGPError PGPGetPFLErrorString( PGPError theError,
+ PGPSize bufferSize, char * theString );
+
+
+PGP_END_C_DECLARATIONS
+
+
+#endif /* ] Included_pgpPFLErrors_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPubTypes.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPubTypes.h new file mode 100644 index 0000000000..a420bfb537 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPubTypes.h @@ -0,0 +1,276 @@ +/*____________________________________________________________________________
+ pgpPubTypes.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ Opaque types for various modules go in this file.
+
+ $Id: pgpPubTypes.h,v 1.49.6.1 1999/06/11 06:14:33 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpPubTypes_h /* [ */
+#define Included_pgpPubTypes_h
+
+
+#include "pgpConfig.h"
+#include "pgpBase.h"
+
+
+/*____________________________________________________________________________
+ General data types used by PGPsdk
+____________________________________________________________________________*/
+typedef struct PGPContext * PGPContextRef;
+typedef struct PGPFileSpec * PGPFileSpecRef;
+typedef struct PGPOptionList * PGPOptionListRef;
+
+/*____________________________________________________________________________
+ Data types used by the key manipulation functions
+____________________________________________________________________________*/
+
+typedef struct PGPKeyDB * PGPKeyDBRef;
+typedef struct PGPKey * PGPKeyRef;
+typedef struct PGPSubKey * PGPSubKeyRef;
+typedef struct PGPUserID * PGPUserIDRef;
+typedef struct PGPSig * PGPSigRef;
+typedef struct PGPKeySet * PGPKeySetRef;
+typedef struct PGPKeyList * PGPKeyListRef;
+typedef struct PGPKeyIter * PGPKeyIterRef;
+typedef struct PGPFilter * PGPFilterRef;
+
+typedef struct PGPKeyID
+{
+ /* do not attempt to interpret these bytes; they *will* change */
+ PGPByte opaqueBytes[ 34 ];
+} PGPKeyID;
+
+
+/*____________________________________________________________________________
+ Data types used by symmetric ciphers, cipher modes, hashing
+____________________________________________________________________________*/
+typedef struct PGPHashContext * PGPHashContextRef;
+typedef struct PGPHMACContext * PGPHMACContextRef;
+typedef struct PGPPublicKeyContext * PGPPublicKeyContextRef;
+typedef struct PGPPrivateKeyContext * PGPPrivateKeyContextRef;
+typedef struct PGPCBCContext * PGPCBCContextRef;
+typedef struct PGPCFBContext * PGPCFBContextRef;
+typedef struct PGPSymmetricCipherContext * PGPSymmetricCipherContextRef;
+
+/*____________________________________________________________________________
+ Data types used by keyserver code
+____________________________________________________________________________*/
+
+typedef struct PGPKeyServer * PGPKeyServerRef;
+
+/*____________________________________________________________________________
+ Invalid values for each of the "ref" data types. Use these for assignment
+ and initialization only. Use the PGPXXXRefIsValid macros (below) to test
+ for valid/invalid values.
+____________________________________________________________________________*/
+
+#define kInvalidPGPContextRef ((PGPContextRef) NULL)
+#define kInvalidPGPFileSpecRef ((PGPFileSpecRef) NULL)
+#define kInvalidPGPOptionListRef ((PGPOptionListRef) NULL)
+
+#define kInvalidPGPKeyDBRef ((PGPKeyDBRef) NULL)
+#define kInvalidPGPKeyRef ((PGPKeyRef) NULL)
+#define kInvalidPGPSubKeyRef ((PGPSubKeyRef) NULL)
+#define kInvalidPGPUserIDRef ((PGPUserIDRef) NULL)
+#define kInvalidPGPSigRef ((PGPSigRef) NULL)
+#define kInvalidPGPKeySetRef ((PGPKeySetRef) NULL)
+#define kInvalidPGPKeyListRef ((PGPKeyListRef) NULL)
+#define kInvalidPGPKeyIterRef ((PGPKeyIterRef) NULL)
+#define kInvalidPGPFilterRef ((PGPFilterRef) NULL)
+#define kInvalidPGPKeyServerRef ((PGPKeyServerRef) NULL)
+
+
+#define kInvalidPGPHashContextRef \
+ ((PGPHashContextRef) NULL)
+#define kInvalidPGPHMACContextRef \
+ ((PGPHMACContextRef) NULL)
+#define kInvalidPGPCFBContextRef \
+ ((PGPCFBContextRef) NULL)
+#define kInvalidPGPCBCContextRef \
+ ((PGPCBCContextRef) NULL)
+#define kInvalidPGPSymmetricCipherContextRef \
+ ((PGPSymmetricCipherContextRef) NULL)
+#define kInvalidPGPPublicKeyContextRef \
+ ((PGPPublicKeyContextRef) NULL)
+#define kInvalidPGPPrivateKeyContextRef \
+ ((PGPPrivateKeyContextRef) NULL)
+
+/* kPGPInvalidRef is deprecated. Please use a type-specific version */
+#define kPGPInvalidRef NULL
+
+/*____________________________________________________________________________
+ Macros to test for ref validity. Use these in preference to comparing
+ directly with the kInvalidXXXRef values.
+____________________________________________________________________________*/
+
+#define PGPContextRefIsValid( ref ) ( (ref) != kInvalidPGPContextRef )
+#define PGPFileSpecRefIsValid( ref ) ( (ref) != kInvalidPGPFileSpecRef )
+#define PGPOptionListRefIsValid( ref ) ( (ref) != kInvalidPGPOptionListRef )
+
+#define PGPKeyDBRefIsValid( ref ) ( (ref) != kInvalidPGPKeyDBRef )
+#define PGPKeyRefIsValid( ref ) ( (ref) != kInvalidPGPKeyRef )
+#define PGPSubKeyRefIsValid( ref ) ( (ref) != kInvalidPGPSubKeyRef )
+#define PGPUserIDRefIsValid( ref ) ( (ref) != kInvalidPGPUserIDRef )
+#define PGPSigRefIsValid( ref ) ( (ref) != kInvalidPGPSigRef )
+#define PGPKeySetRefIsValid( ref ) ( (ref) != kInvalidPGPKeySetRef )
+#define PGPKeyListRefIsValid( ref ) ( (ref) != kInvalidPGPKeyListRef )
+#define PGPKeyIterRefIsValid( ref ) ( (ref) != kInvalidPGPKeyIterRef )
+#define PGPFilterRefIsValid( ref ) ( (ref) != kInvalidPGPFilterRef )
+#define PGPKeyServerRefIsValid( ref ) ( (ref) != kInvalidPGPKeyServerRef )
+
+#define PGPHashContextRefIsValid( ref ) \
+ ( (ref) != kInvalidPGPHashContextRef )
+#define PGPHMACContextRefIsValid( ref ) \
+ ( (ref) != kInvalidPGPHMACContextRef )
+#define PGPCFBContextRefIsValid( ref ) \
+ ( (ref) != kInvalidPGPCFBContextRef )
+#define PGPCBCContextRefIsValid( ref ) \
+ ( (ref) != kInvalidPGPCBCContextRef )
+#define PGPSymmetricCipherContextRefIsValid( ref ) \
+ ( (ref) != kInvalidPGPSymmetricCipherContextRef )
+#define PGPPublicKeyContextRefIsValid( ref ) \
+ ( (ref) != kInvalidPGPPublicKeyContextRef )
+#define PGPPrivateKeyContextRefIsValid( ref ) \
+ ( (ref) != kInvalidPGPPrivateKeyContextRef )
+
+/* PGPRefIsValid() is deprecated. Please use a type-specific version */
+#define PGPRefIsValid( ref ) ( (ref) != kPGPInvalidRef )
+
+/*____________________________________________________________________________
+ Symmetric Ciphers
+____________________________________________________________________________*/
+
+enum PGPCipherAlgorithm_
+{
+ /* do NOT change these values */
+ kPGPCipherAlgorithm_None = 0,
+ kPGPCipherAlgorithm_IDEA = 1,
+ kPGPCipherAlgorithm_3DES = 2,
+ kPGPCipherAlgorithm_CAST5 = 3,
+
+ kPGPCipherAlgorithm_First = kPGPCipherAlgorithm_IDEA,
+ kPGPCipherAlgorithm_Last = kPGPCipherAlgorithm_CAST5,
+
+ PGP_ENUM_FORCE( PGPCipherAlgorithm_ )
+};
+PGPENUM_TYPEDEF( PGPCipherAlgorithm_, PGPCipherAlgorithm );
+
+/*____________________________________________________________________________
+ Hash algorithms
+____________________________________________________________________________*/
+
+enum PGPHashAlgorithm_
+{
+ /* do NOT change these values */
+ kPGPHashAlgorithm_Invalid = 0,
+ kPGPHashAlgorithm_MD5 = 1,
+ kPGPHashAlgorithm_SHA = 2,
+ kPGPHashAlgorithm_RIPEMD160 = 3,
+
+ kPGPHashAlgorithm_First = kPGPHashAlgorithm_MD5,
+ kPGPHashAlgorithm_Last = kPGPHashAlgorithm_RIPEMD160,
+
+ PGP_ENUM_FORCE( PGPHashAlgorithm_ )
+};
+PGPENUM_TYPEDEF( PGPHashAlgorithm_, PGPHashAlgorithm );
+
+/*____________________________________________________________________________
+ Public/Private key algorithms
+____________________________________________________________________________*/
+enum PGPPublicKeyAlgorithm_
+{
+ /* note: do NOT change these values */
+ kPGPPublicKeyAlgorithm_Invalid = 0xFFFFFFFF,
+ kPGPPublicKeyAlgorithm_RSA = 1,
+ kPGPPublicKeyAlgorithm_RSAEncryptOnly = 2,
+ kPGPPublicKeyAlgorithm_RSASignOnly = 3,
+ kPGPPublicKeyAlgorithm_ElGamal = 0x10, /* A.K.A.Diffie-Hellman */
+ kPGPPublicKeyAlgorithm_DSA = 0x11,
+
+ kPGPPublicKeyAlgorithm_First = kPGPPublicKeyAlgorithm_RSA,
+ kPGPPublicKeyAlgorithm_Last = kPGPPublicKeyAlgorithm_DSA,
+
+ PGP_ENUM_FORCE( PGPPublicKeyAlgorithm_ )
+};
+PGPENUM_TYPEDEF( PGPPublicKeyAlgorithm_, PGPPublicKeyAlgorithm );
+
+/*____________________________________________________________________________
+ Trust values, used to set validity values
+____________________________________________________________________________*/
+
+#define kPGPKeyTrust_Mask 0x7u
+#define kPGPKeyTrust_Undefined 0x0u
+#define kPGPKeyTrust_Unknown 0x1u
+#define kPGPKeyTrust_Never 0x2u
+#define kPGPKeyTrust_Marginal 0x5u
+#define kPGPKeyTrust_Complete 0x6u
+#define kPGPKeyTrust_Ultimate 0x7u
+
+#define kPGPNameTrust_Mask 0x3u
+#define kPGPNameTrust_Unknown 0x0u
+#define kPGPNameTrust_Untrusted 0x1u
+#define kPGPNameTrust_Marginal 0x2u
+#define kPGPNameTrust_Complete 0x3u
+
+/*____________________________________________________________________________
+ Validity levels, used for thresholds in options
+____________________________________________________________________________*/
+
+enum PGPValidity_
+{
+ kPGPValidity_Unknown = kPGPNameTrust_Unknown,
+ kPGPValidity_Invalid = kPGPNameTrust_Untrusted,
+ kPGPValidity_Marginal = kPGPNameTrust_Marginal,
+ kPGPValidity_Complete = kPGPNameTrust_Complete,
+
+ PGP_ENUM_FORCE( PGPValidity_ )
+} ;
+PGPENUM_TYPEDEF( PGPValidity_, PGPValidity );
+
+/*____________________________________________________________________________
+ Line endings types
+____________________________________________________________________________*/
+
+enum PGPLineEndType_
+{
+ kPGPLineEnd_Default = 0,
+ kPGPLineEnd_LF = 1,
+ kPGPLineEnd_CR = 2,
+ kPGPLineEnd_CRLF = (kPGPLineEnd_LF | kPGPLineEnd_CR),
+ PGP_ENUM_FORCE( PGPLineEndType_ )
+};
+PGPENUM_TYPEDEF( PGPLineEndType_, PGPLineEndType );
+
+/*____________________________________________________________________________
+ Local encoding types
+
+ Only one of Force or Auto should be used. The other values are modifiers
+____________________________________________________________________________*/
+
+#define kPGPLocalEncoding_None 0x0 /* nothing on */
+#define kPGPLocalEncoding_Force 0x01
+#define kPGPLocalEncoding_Auto 0x02
+#define kPGPLocalEncoding_NoMacBinCRCOkay 0x04
+
+typedef PGPFlags PGPLocalEncodingFlags;
+
+
+/* max length is 255; the +1 is for the trailing \0 */
+#define kPGPMaxUserIDSize ( (PGPSize)255 + 1 )
+
+/* Size of buffer for PGP-MIME separator (null terminated) */
+#define kPGPMimeSeparatorSize 81
+
+#endif /* ] Included_pgpPubTypes_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPublicKey.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPublicKey.h new file mode 100644 index 0000000000..d780876a75 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpPublicKey.h @@ -0,0 +1,213 @@ +/*____________________________________________________________________________
+ pgpPublicKey.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpPublicKey.h,v 1.10 1999/03/10 02:54:43 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpPublicKey_h /* [ */
+#define Included_pgpPublicKey_h
+
+#include "pgpPubTypes.h"
+#include "pgpOptionList.h"
+
+
+
+/*____________________________________________________________________________
+ Encryption/Signature Message Formats
+____________________________________________________________________________*/
+
+enum PGPPublicKeyMessageFormat_
+{
+ kPGPPublicKeyMessageFormat_PGP = 1,
+ kPGPPublicKeyMessageFormat_PKCS1 = 2,
+ kPGPPublicKeyMessageFormat_X509 = 3,
+ kPGPPublicKeyMessageFormat_IKE = 4,
+
+ PGP_ENUM_FORCE( PGPPublicKeyMessageFormat_ )
+};
+PGPENUM_TYPEDEF( PGPPublicKeyMessageFormat_, PGPPublicKeyMessageFormat );
+
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+
+/*____________________________________________________________________________
+ Public-key operations
+____________________________________________________________________________*/
+
+
+
+/*____________________________________________________________________________
+ Return a context for public-key operations based on the specified key.
+ The specified message format is used for all operations with this
+ context.
+____________________________________________________________________________*/
+PGPError PGPNewPublicKeyContext( PGPKeyRef publicKeyRef,
+ PGPPublicKeyMessageFormat messageFormat,
+ PGPPublicKeyContextRef *outRef );
+
+
+/*____________________________________________________________________________
+ Dispose of a public-key context.
+____________________________________________________________________________*/
+PGPError PGPFreePublicKeyContext( PGPPublicKeyContextRef ref );
+
+
+/*____________________________________________________________________________
+ Determine maximum sizes for inputs and outputs.
+____________________________________________________________________________*/
+PGPError PGPGetPublicKeyOperationSizes( PGPPublicKeyContextRef ref,
+ PGPSize *maxDecryptedBufferSize,
+ PGPSize *maxEncryptedBufferSize,
+ PGPSize *maxSignatureSize );
+
+
+/*____________________________________________________________________________
+ Encrypt one block of data, using PKCS-1 padding. Output buffer must
+ be of size maxEncryptedBufferSize from PGPGetPublicKeyEncryptionSize.
+ outSize is a return parameter. For some formatting modes the actual
+ output size may be less than the maximum possible.
+____________________________________________________________________________*/
+PGPError PGPPublicKeyEncrypt( PGPPublicKeyContextRef ref,
+ void const *in, PGPSize inSize, void *out,
+ PGPSize *outSize );
+
+
+/*____________________________________________________________________________
+ Verify a signature on a message hash. Returns kPGPError_NoErr on
+ correct verification, else an error code. The message hash is
+ finalized and freed by this call (and should not have been finalized
+ prior to the call).
+____________________________________________________________________________*/
+
+PGPError PGPPublicKeyVerifySignature( PGPPublicKeyContextRef ref,
+ PGPHashContextRef hashContext,
+ void const *signature, PGPSize signatureSize );
+
+
+/*____________________________________________________________________________
+ Verify a signature on a low-level buffer. Returns kPGPError_NOErr
+ correct verification, else an error code. Not valid with
+ kPGPPublicKeyMessageFormat_PGP contexts.
+____________________________________________________________________________*/
+
+PGPError PGPPublicKeyVerifyRaw( PGPPublicKeyContextRef ref,
+ void const *signedData, PGPSize signedDataSize,
+ void const *signature, PGPSize signatureSize );
+
+
+/*____________________________________________________________________________
+ Private-key operations
+____________________________________________________________________________*/
+
+
+
+/*____________________________________________________________________________
+ Return a context for private-key operations based on the specified
+ key (which must have a private part). The specified message
+ format is used for all operations with this context. Unlocks key
+ data using passphrase.
+____________________________________________________________________________*/
+
+
+PGPError PGPNewPrivateKeyContext( PGPKeyRef privateKeyRef,
+ PGPPublicKeyMessageFormat messageFormat,
+ PGPPrivateKeyContextRef *outRef,
+ PGPOptionListRef firstOption, ...);
+
+/*____________________________________________________________________________
+ Dispose of a private-key context. All sensitive data is wiped before
+ being deleted.
+____________________________________________________________________________*/
+PGPError PGPFreePrivateKeyContext( PGPPrivateKeyContextRef ref );
+
+
+/*____________________________________________________________________________
+ Determine maximum sizes for inputs and outputs.
+____________________________________________________________________________*/
+PGPError PGPGetPrivateKeyOperationSizes( PGPPrivateKeyContextRef ref,
+ PGPSize *maxDecryptedBufferSize,
+ PGPSize *maxEncryptedBufferSize,
+ PGPSize *maxSignatureSize);
+
+
+/*____________________________________________________________________________
+ Decrypt one block of data. Output buffer must be of size at least
+ maxDecryptedBufferSize from PGPGetPrivateKeyDecryptionSize.
+ outSize is a return parameter. For some formatting modes the actual
+ output size may be less than the maximum possible.
+____________________________________________________________________________*/
+PGPError PGPPrivateKeyDecrypt( PGPPrivateKeyContextRef ref,
+ void const *in, PGPSize inSize, void *out,
+ PGPSize *outSize );
+
+
+/*____________________________________________________________________________
+ Sign a message hash. Output signature buffer must be of size at
+ least maxSignatureSize from PGPGetPrivateKeyDecryptionSize.
+ signatureSize is a return parameter. For some formatting modes
+ the actual signature size may be less than the maximum possible.
+ The message hash is finalized and freed by this call (and should
+ not have been finalized prior to the call).
+____________________________________________________________________________*/
+
+
+PGPError PGPPrivateKeySign( PGPPrivateKeyContextRef ref,
+ PGPHashContextRef hashContext,
+ void *signature, PGPSize *signatureSize );
+
+/*____________________________________________________________________________
+ Sign a low level signedData buffer. Output signature buffer must be
+ of size at least maxSignatureSize from PGPGetPrivateKeyDecryptionSize.
+ signatureSize is a return parameter. Not valid with
+ kPGPPublicKeyMessageFormat_PGP contexts.
+____________________________________________________________________________*/
+
+PGPError PGPPrivateKeySignRaw( PGPPrivateKeyContextRef ref,
+ void const *signedData, PGPSize signedDataSize,
+ void const *signature, PGPSize *signatureSize );
+
+
+/*____________________________________________________________________________
+ Miscellaneous operations
+____________________________________________________________________________*/
+
+
+
+/*____________________________________________________________________________
+Given the size of a prime modulus in bits, this returns an appropriate
+size for an exponent in bits, such that the work factor to find a
+discrete log modulo the modulus is approximately equal to half the
+length of the exponent. This makes the exponent an appropriate size
+for a subgroup in a discrete log signature scheme. For encryption
+schemes, where decryption attacks can be stealthy and undetected, we
+use 3/2 times the returned exponent size.
+____________________________________________________________________________*/
+
+PGPError PGPDiscreteLogExponentBits( PGPUInt32 modulusBits,
+ PGPUInt32 *exponentBits );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpPublicKey_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpRandomPool.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpRandomPool.h new file mode 100644 index 0000000000..5a7fabeb7e --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpRandomPool.h @@ -0,0 +1,49 @@ +/*____________________________________________________________________________
+ pgpRandomPool.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpRandomPool.h,v 1.13 1999/04/13 17:43:18 cpeterson Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpRandomPool_h /* [ */
+#define Included_pgpRandomPool_h
+
+#include "pgpBase.h"
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+PGPUInt32 PGPGlobalRandomPoolAddKeystroke( PGPInt32 event);
+PGPUInt32 PGPGlobalRandomPoolMouseMoved(void);
+PGPError PGPGlobalRandomPoolAddSystemState(void);
+
+/* Extra functions for entropy estimation */
+PGPUInt32 PGPGlobalRandomPoolGetEntropy( void );
+PGPUInt32 PGPGlobalRandomPoolGetSize( void );
+PGPUInt32 PGPGlobalRandomPoolGetMinimumEntropy( void );
+PGPBoolean PGPGlobalRandomPoolHasMinimumEntropy( void );
+
+
+#if PGP_DEPRECATED
+PGPUInt32 PGPGlobalRandomPoolAddMouse( PGPUInt32 x, PGPUInt32 y);
+#endif
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpRandomPool_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSDKPrefs.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSDKPrefs.h new file mode 100644 index 0000000000..2662786474 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSDKPrefs.h @@ -0,0 +1,74 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ $Id: pgpSDKPrefs.h,v 1.7 1999/05/17 07:53:20 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpCDKPrefs_h /* [ */
+#define Included_pgpCDKPrefs_h
+
+#include "pgpConfig.h"
+#include "pgpPubTypes.h"
+
+
+enum PGPsdkPrefSelector_
+{
+ kPGPsdkPref_DefaultKeyID = 3,
+ kPGPsdkPref_PublicKeyring = 5,
+ kPGPsdkPref_PrivateKeyring = 6,
+ kPGPsdkPref_RandomSeedFile = 7,
+ kPGPsdkPref_GroupsFile = 8,
+
+ PGP_ENUM_FORCE( PGPsdkPrefSelector_ )
+};
+PGPENUM_TYPEDEF( PGPsdkPrefSelector_, PGPsdkPrefSelector );
+
+
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/* call this if you want the CDK to use prefs stored in the prefs file */
+PGPError PGPsdkLoadPrefs( PGPContextRef context,
+ PGPFileSpecRef prefSpec );
+PGPError PGPsdkLoadDefaultPrefs( PGPContextRef context );
+
+/* save any changed preferences to disk */
+PGPError PGPsdkSavePrefs( PGPContextRef context );
+
+
+PGPError PGPsdkPrefSetFileSpec( PGPContextRef context,
+ PGPsdkPrefSelector selector, PGPFileSpecRef ref );
+
+/* caller must deallocate *outRef with PGPFreeFileSpec */
+PGPError PGPsdkPrefGetFileSpec( PGPContextRef context,
+ PGPsdkPrefSelector selector, PGPFileSpecRef * outRef );
+
+
+PGPError PGPsdkPrefSetData( PGPContextRef context,
+ PGPsdkPrefSelector selector,
+ void const *data, PGPSize size );
+
+/* caller must deallocate *dataOut with PGPFreeData */
+PGPError PGPsdkPrefGetData( PGPContextRef context,
+ PGPsdkPrefSelector selector,
+ void **dataOut, PGPSize *sizeOut );
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpCDKPrefs_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSockets.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSockets.h new file mode 100644 index 0000000000..c884cc5523 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSockets.h @@ -0,0 +1,476 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+
+
+ $Id: pgpSockets.h,v 1.27.6.1.6.1 1999/08/04 18:36:04 sluu Exp $
+____________________________________________________________________________*/
+
+
+#ifndef Included_pgpSockets_h /* [ */
+#define Included_pgpSockets_h
+
+#include <stdio.h>
+
+#include "pgpOptionList.h"
+#include "pgpTLS.h"
+#include "pgpErrors.h"
+
+#if PGP_UNIX
+# include <sys/types.h>
+# include <sys/socket.h>
+#if PGP_UNIX_LINUX
+# include <sys/time.h> /* Needed for unknown reason */
+# include <sys/ioctl.h> /* Need FIONREAD */
+#elif PGP_UNIX_SOLARIS
+# include <sys/filio.h>
+#elif PGP_UNIX_AIX
+# include <sys/time.h>
+# include <sys/ioctl.h>
+#endif /* ! PGP_UNIX_LINUX */
+# include <netinet/in.h>
+# include <netdb.h>
+#endif
+
+#if PGP_WIN32
+# include <winsock.h>
+#endif
+
+PGP_BEGIN_C_DECLARATIONS
+
+#if PRAGMA_IMPORT_SUPPORTED
+# pragma import on
+#endif
+
+typedef struct PGPSocket * PGPSocketRef;
+
+/*
+ * Unix and Windows share the same Berkley socket interface. This isn't
+ * the most efficient Windows implmentation of TCP/IP, but it is
+ * compatable with UNIX berkley sockets, making cross-platform possible.
+ *
+ * Trying to write cross-platform win32 TCP/IP code using all the fancy
+ * dancy Win32 network functions would be nearly impossible IMHO
+ *
+ * The Mac doesn't have the berkley stuff, so we roll our own for all
+ * of the structures.
+ *
+ * Start with Unix and Win32
+ */
+#if PGP_UNIX || PGP_WIN32
+
+# define kInvalidPGPSocketRef ((PGPSocketRef) (~0))
+
+ typedef struct hostent PGPHostEntry;
+ typedef struct protoent PGPProtocolEntry;
+ typedef struct servent PGPServiceEntry;
+ typedef struct sockaddr_in PGPSocketAddressInternet;
+ typedef struct sockaddr PGPSocketAddress;
+ typedef struct in_addr PGPInternetAddress;
+ typedef fd_set PGPSocketSet;
+ typedef struct timeval PGPSocketsTimeValue;
+
+# define PGPSOCKETSET_CLEAR(socketRef, set) FD_CLR((int) (socketRef), (set))
+# define PGPSOCKETSET_SET(socketRef, set) FD_SET((int) (socketRef), (set))
+# define PGPSOCKETSET_ZERO(set) FD_ZERO((set))
+# define PGPSOCKETSET_ISSET(socketRef, set) FD_ISSET((int) (socketRef), (set))
+
+ /* Address families */
+ enum {
+ kPGPAddressFamilyUnspecified = AF_UNSPEC,
+ kPGPAddressFamilyInternet = AF_INET
+ };
+
+ /* Protocol families */
+ enum {
+ kPGPProtocolFamilyInternet = PF_INET
+ };
+
+ /* Types */
+ enum {
+ kPGPSocketTypeStream = SOCK_STREAM,
+ kPGPSocketTypeDatagram = SOCK_DGRAM
+ };
+
+ /* Commands for PGPIOControlSocket */
+ enum {
+ kPGPSocketCommandGetUnreadData = FIONREAD
+ };
+
+ /* Levels for PGPGetSocketOptions and PGPSetSocketOptions */
+ enum {
+ kPGPSocketOptionLevelSocket = SOL_SOCKET
+ };
+
+ /* Options for PGPGetSocketOptions and PGPSetSocketOptions */
+/* On Linux (2.0.24), include <asm/socket.h> has SOL_SOCKET and SO_TYPE, */
+/* but unclear as to what would correspond to SO_ACCEPTCONN, if any. */
+#if PGP_UNIX_LINUX
+/* #ifndef SO_ACCEPTCONN */
+#define SO_ACCEPTCONN 0
+/* #endif */ /* SO_ACCEPTCONN */
+#endif /* PGP_UNIX_LINUX */
+ enum {
+ kPGPSocketOptionAcceptingConnections = SO_ACCEPTCONN,
+ kPGPSocketOptionType = SO_TYPE
+ };
+
+ /* Protocols */
+ enum {
+ kPGPTCPProtocol = IPPROTO_TCP,
+ kPGPUDPProtocol = IPPROTO_UDP
+ };
+
+ /* Send flags */
+ enum {
+ kPGPSendFlagNone = 0
+ };
+
+ /* Receive flags */
+ enum {
+ kPGPReceiveFlagNone = 0
+ };
+
+ /* Internet Addresses */
+ enum {
+ kPGPInternetAddressAny = INADDR_ANY
+ };
+
+#endif /* PGP_UNIX || PGP_WIN32 */
+
+/*
+ * Onto the Mac, where we need to create our own versions of the various
+ * structures.
+ */
+#if PGP_MACINTOSH
+
+# define kInvalidPGPSocketRef ((PGPSocketRef) NULL)
+
+ typedef struct PGPInternetAddress {
+ union {
+ struct {
+ PGPByte s_b1;
+ PGPByte s_b2;
+ PGPByte s_b3;
+ PGPByte s_b4;
+ } S_un_b;
+ struct {
+ PGPUInt16 s_w1;
+ PGPUInt16 s_w2;
+ } S_un_w;
+ PGPUInt32 S_addr;
+ } S_un;
+# define s_addr S_un.S_addr
+ } PGPInternetAddress;
+
+ typedef struct PGPSocketAddressInternet {
+ PGPInt16 sin_family;
+ PGPUInt16 sin_port;
+ PGPInternetAddress sin_addr;
+ PGPByte sin_zero[8];
+ } PGPSocketAddressInternet;
+
+ typedef struct PGPSocketAddress {
+ PGPUInt16 sa_family;
+ PGPByte sa_data[14];
+ } PGPSocketAddress;
+
+ typedef struct PGPHostEntry {
+ char * h_name;
+ char ** unused;
+ PGPInt16 h_addrtype;
+ PGPInt16 h_length;
+ char ** h_addr_list;
+# define h_addr h_addr_list[0]
+ } PGPHostEntry;
+
+ typedef struct PGPProtocolEntry {
+ char * p_name;
+ char ** p_aliases;
+ PGPInt16 p_proto;
+ } PGPProtocolEntry;
+
+ typedef struct PGPServiceEntry {
+ char * s_name;
+ char ** s_aliases;
+ PGPUInt16 s_port;
+ char * s_proto;
+ } PGPServiceEntry;
+
+ /* Select types and defines */
+# ifndef PGPSOCKETSET_SETSIZE
+# define PGPSOCKETSET_SETSIZE 64
+# endif
+
+ typedef struct PGPSocketSet {
+ PGPUInt16 fd_count;
+ PGPSocketRef fd_array[PGPSOCKETSET_SETSIZE];
+ } PGPSocketSet;
+
+# define PGPSOCKETSET_CLEAR(socketRef, set) do { \
+ PGPUInt16 __i; \
+ for (__i = 0; __i < ((PGPSocketSet * (set))->fd_count; __i++) { \
+ if (((PGPSocketSet *) (set))->fd_array[__i] == socketRef) { \
+ while (__i < (((PGPSocketSet *) (set))->fd_count - 1)) { \
+ ((PGPSocketSet *) (set))->fd_array[__i] = \
+ ((PGPSocketSet *) (set))->fd_array[__i + 1]; \
+ __i++; \
+ } \
+ ((PGPSocketSet *) (set))->fd_count--; \
+ break; \
+ } \
+ } \
+ } while (0)
+
+# define PGPSOCKETSET_SET(socketRef, set) do { \
+ if (((PGPSocketSet *) (set))->fd_count < PGPSOCKETSET_SETSIZE) { \
+ ((PGPSocketSet *) (set))->fd_array[((PGPSocketSet *) \
+ (set))->fd_count++] = (socketRef); \
+ } \
+ } while (0)
+
+# define PGPSOCKETSET_ZERO(set) (((PGPSocketSet *) (set))->fd_count = 0)
+
+ PGPInt32 __PGPSocketsIsSet(PGPSocketRef, PGPSocketSet *);
+
+# define PGPSOCKETSET_ISSET(socketRef, set) __PGPSocketsIsSet( \
+ (socketRef),(set))
+
+ typedef struct PGPSocketsTimeValue {
+ PGPInt32 tv_sec; /* seconds */
+ PGPInt32 tv_usec; /* and microseconds */
+ } PGPSocketsTimeValue;
+
+ /* Address families */
+ enum {
+ kPGPAddressFamilyUnspecified = 0,
+ kPGPAddressFamilyInternet = 2
+ };
+
+ /* Protocol families */
+ enum {
+ kPGPProtocolFamilyInternet = kPGPAddressFamilyInternet
+ };
+
+ /* Types */
+ enum {
+ kPGPSocketTypeStream = 1,
+ kPGPSocketTypeDatagram = 2
+ };
+
+ /* Commands for PGPIOControlSocket */
+ enum {
+ kPGPSocketCommandGetUnreadData = (0x40000000
+ | (((long) sizeof(PGPUInt32) & 0x7F) << 16) | ('f' << 8) | 127)
+ };
+
+ /* Levels for PGPGetSocketOptions and PGPSetSocketOptions */
+ enum {
+ kPGPSocketOptionLevelSocket = 0xFFFFFFFF
+ };
+
+ /* Options for PGPGetSocketOptions and PGPSetSocketOptions */
+ enum {
+ kPGPSocketOptionAcceptingConnections = 0x00000002,
+ kPGPSocketOptionType = 0x00001008
+ };
+
+ /* Protocols */
+ enum {
+ kPGPTCPProtocol = 6,
+ kPGPUDPProtocol = 17
+ };
+
+ /* Send flags */
+ enum {
+ kPGPSendFlagNone = 0
+ };
+
+ /* Receive flags */
+ enum {
+ kPGPReceiveFlagNone = 0
+ };
+
+ /* Internet Addresses */
+ enum {
+ kPGPInternetAddressAny = 0x00000000
+ };
+
+#endif /* PGP_MACINTOSH */
+
+/*
+ * Some global things for all platforms
+ */
+
+#define PGPSocketRefIsValid(ref) ((ref) != kInvalidPGPSocketRef)
+
+typedef struct PGPSocketsThreadStorage * PGPSocketsThreadStorageRef;
+# define kInvalidPGPSocketsThreadStorageRef \
+ ((PGPSocketsThreadStorageRef) NULL)
+#define PGPSocketsThreadStorageRefIsValid(ref) \
+ ((ref) != kInvalidPGPSocketsThreadStorageRef)
+
+/* Errors */
+#define kPGPSockets_Error -1
+
+/* Net byte ordering macros (PGP_WORDSBIGENDIAN defined by configure) */
+#if PGP_WORDSBIGENDIAN
+# define PGPHostToNetLong(x) (x)
+# define PGPHostToNetShort(x) (x)
+# define PGPNetToHostLong(x) (x)
+# define PGPNetToHostShort(x) (x)
+#else
+ PGPInt32 PGPHostToNetLong(PGPInt32 x);
+ PGPInt16 PGPHostToNetShort(PGPInt16 x);
+ PGPInt32 PGPNetToHostLong(PGPInt32 x);
+ PGPInt16 PGPNetToHostShort(PGPInt16 x);
+#endif /* PGP_WORDSBIGENDIAN */
+
+/*
+ * Shared function interface (except for idle handler code)
+ */
+
+/*
+ * Use the idle event handler to receive periodic idle events during
+ * network calls. Usually this is used only in non-preemptive multi-tasking
+ * OSes to allow yielding in threads. Pre-emptive multi-tasking systems
+ * should probably not use the call as it interrupts the efficient wait state
+ * of threads waiting on network calls.
+ *
+ * Idle event handlers need to be added on a per thread basis.
+ *
+ * Returning an error from the idle event handler will cause the socket
+ * that is blocking to close.
+ *
+ */
+PGPError PGPSetSocketsIdleEventHandler(
+ PGPEventHandlerProcPtr inCallback,
+ PGPUserValue inUserData);
+
+PGPError PGPGetSocketsIdleEventHandler(
+ PGPEventHandlerProcPtr * outCallback,
+ PGPUserValue * outUserData);
+
+/* Static storage creation */
+PGPError PGPSocketsCreateThreadStorage(
+ PGPSocketsThreadStorageRef * outPreviousStorage);
+PGPError PGPSocketsDisposeThreadStorage(
+ PGPSocketsThreadStorageRef inPreviousStorage);
+
+/* Stack based class for saving and restoring thread storage */
+#ifdef __cplusplus /* [ */
+class StPGPPreserveSocketsStorage {
+public:
+ StPGPPreserveSocketsStorage() : mStorage(NULL)
+ { PGPSocketsCreateThreadStorage(&mStorage); }
+ ~StPGPPreserveSocketsStorage()
+ { PGPSocketsDisposeThreadStorage(mStorage); }
+
+protected:
+ PGPSocketsThreadStorageRef mStorage;
+};
+#endif /* ] __cplusplus */
+
+
+/* Initialization and termination */
+PGPError PGPSocketsInit(void);
+void PGPSocketsCleanup(void);
+
+/* Socket creation and destruction */
+PGPSocketRef PGPOpenSocket(PGPInt32 inAddressFamily, PGPInt32 inSocketType,
+ PGPInt32 inSocketProtocol);
+PGPInt32 PGPCloseSocket(PGPSocketRef inSocketRef);
+
+/* Endpoint binding */
+PGPInt32 PGPBindSocket(PGPSocketRef inSocketRef,
+ const PGPSocketAddress * inAddress,
+ PGPInt32 inAddressLength);
+PGPInt32 PGPConnect(PGPSocketRef inSocketRef,
+ const PGPSocketAddress * inServerAddress,
+ PGPInt32 inAddressLength);
+
+/* Send functions */
+PGPInt32 PGPSend(PGPSocketRef inSocketRef, const void * inBuffer,
+ PGPInt32 inBufferLength, PGPInt32 inFlags);
+PGPInt32 PGPWrite(PGPSocketRef inSocketRef, const void * inBuffer,
+ PGPInt32 inBufferLength);
+PGPInt32 PGPSendTo(PGPSocketRef inSocketRef, const void * inBuffer,
+ PGPInt32 inBufferLength, PGPInt32 inFlags,
+ PGPSocketAddress * inAddress,
+ PGPInt32 inAddressLength);
+
+/* Receive functions */
+PGPInt32 PGPReceive(PGPSocketRef inSocketRef, void * outBuffer,
+ PGPInt32 inBufferSize, PGPInt32 inFlags);
+PGPInt32 PGPRead(PGPSocketRef inSocketRef, void * outBuffer,
+ PGPInt32 inBufferSize);
+PGPInt32 PGPReceiveFrom(PGPSocketRef inSocketRef, void * outBuffer,
+ PGPInt32 inBufferSize, PGPInt32 inFlags,
+ PGPSocketAddress * outAddress,
+ PGPInt32 * ioAddressLength);
+
+/* Server functions */
+PGPInt32 PGPListen(PGPSocketRef inSocketRef, PGPInt32 inMaxBacklog);
+PGPSocketRef PGPAccept(PGPSocketRef inSocketRef,
+ PGPSocketAddress * outAddress,
+ PGPInt32 * ioAddressLength);
+
+/* Select */
+/* Note that inNumSetCount is not used under Mac and Windows */
+PGPInt32 PGPSelect(PGPInt32 inNumSetCount,
+ PGPSocketSet * ioReadSet,
+ PGPSocketSet * ioWriteSet,
+ PGPSocketSet * ioErrorSet,
+ const PGPSocketsTimeValue * inTimeout);
+
+/* DNS and protocol services */
+PGPHostEntry * PGPGetHostByName(const char * inName);
+PGPHostEntry * PGPGetHostByAddress(const char* inAddress,
+ PGPInt32 inLength,
+ PGPInt32 inType);
+PGPInt32 PGPGetHostName(char * outName, PGPInt32 inNameLength);
+PGPProtocolEntry * PGPGetProtocolByName(const char * inName);
+PGPProtocolEntry * PGPGetProtocolByNumber(PGPInt32 inNumber);
+PGPServiceEntry * PGPGetServiceByName(const char * inName,
+ const char * inProtocol);
+PGPServiceEntry * PGPGetServiceByPort(PGPInt32 inPort,
+ const char * inProtocol);
+
+/* Error reporting */
+PGPError PGPGetLastSocketsError(void);
+
+/* Utilities */
+PGPInt32 PGPGetSocketName(PGPSocketRef inSocketRef,
+ PGPSocketAddress * outName,
+ PGPInt32 * ioNameLength);
+PGPInt32 PGPGetPeerName(PGPSocketRef inSocketRef,
+ PGPSocketAddress * outName,
+ PGPInt32 * ioNameLength);
+PGPUInt32 PGPDottedToInternetAddress(const char * inAddress);
+char * PGPInternetAddressToDottedString(PGPInternetAddress inAddress);
+
+/* Control and options */
+PGPInt32 PGPIOControlSocket(PGPSocketRef inSocketRef,
+ PGPInt32 inCommand, PGPUInt32 * ioParam);
+PGPInt32 PGPGetSocketOptions(PGPSocketRef inSocketRef, PGPInt32 inLevel,
+ PGPInt32 inOptionName,
+ char * outOptionValue,
+ PGPInt32 * ioOptionLength);
+PGPInt32 PGPSetSocketOptions(PGPSocketRef inSocketRef, PGPInt32 inLevel,
+ PGPInt32 inOptionName,
+ const char * inOptionValue,
+ PGPInt32 inOptionLength);
+
+/* TLS */
+PGPError PGPSocketsEstablishTLSSession(PGPSocketRef inSocketRef,
+ PGPtlsSessionRef inTLSSession);
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+
+PGP_END_C_DECLARATIONS
+
+#endif /* Included_pgpSockets_h */
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSymmetricCipher.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSymmetricCipher.h new file mode 100644 index 0000000000..b1dec160e2 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpSymmetricCipher.h @@ -0,0 +1,122 @@ +/*____________________________________________________________________________
+ pgpSymmetricCipher.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ public header file for symmetric ciphers
+
+ $Id: pgpSymmetricCipher.h,v 1.22 1999/03/10 02:58:47 heller Exp $
+____________________________________________________________________________*/
+#ifndef Included_pgpSymmetricCipher_h /* [ */
+#define Included_pgpSymmetricCipher_h
+
+#include "pgpPubTypes.h"
+#include "pgpMemoryMgr.h"
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+
+/*____________________________________________________________________________
+ Create a new cipher of the specified algorithm. Cannot be used until
+ PGPSetSymmetricCipherKey() has been called.
+
+ If the algorithm is not available then kPGPError_AlgorithmNotAvailable is
+ returned.
+
+ Existing algorithms have only one key size. Values:
+ kPGPCipherAlgorithm_CAST5 128 / 8 = 16
+ kPGPCipherAlgorithm_3DES 192 / 8 = 24
+ kPGPCipherAlgorithm_IDEA 128 / 8 = 16
+ In the future symmetric ciphers could be added that have different key
+ sizes for the same algorithm.
+____________________________________________________________________________*/
+PGPError PGPNewSymmetricCipherContext( PGPMemoryMgrRef memoryMgr,
+ PGPCipherAlgorithm algorithm, PGPSize keySizeInBytes,
+ PGPSymmetricCipherContextRef *outRef );
+
+
+/*____________________________________________________________________________
+ Disposal clears all data in memory before releasing it.
+____________________________________________________________________________*/
+PGPError PGPFreeSymmetricCipherContext( PGPSymmetricCipherContextRef ref );
+
+
+/*____________________________________________________________________________
+ Make an exact copy of the cipher, including the key.
+____________________________________________________________________________*/
+PGPError PGPCopySymmetricCipherContext( PGPSymmetricCipherContextRef ref,
+ PGPSymmetricCipherContextRef *outRef );
+
+
+/*____________________________________________________________________________
+ The key must be set before using; a cipher can be repeatedly reset and
+ reused with different keys to avoid having to create and destroy new
+ contexts each time (and it's also cryptographically better not to reuse
+ a key).
+
+ kKey size is implicit based on algorithm. 'key' is *copied*. Caller
+ may want to destroy the original after passing it in.
+____________________________________________________________________________*/
+PGPError PGPInitSymmetricCipher( PGPSymmetricCipherContextRef ref,
+ const void *key );
+
+/*____________________________________________________________________________
+ Wipe any sensitive data in the cipher. Cipher remains alive, but
+ key must be set before any data is encrypted.
+____________________________________________________________________________*/
+PGPError PGPWipeSymmetricCipher( PGPSymmetricCipherContextRef ref );
+
+
+/*____________________________________________________________________________
+ "Wash" the symmetric cipher
+____________________________________________________________________________*/
+PGPError PGPWashSymmetricCipher( PGPSymmetricCipherContextRef ref,
+ void const *buf, PGPSize len);
+
+
+/*____________________________________________________________________________
+ Encrypt or decrypt one "block" of data. The block size is determined
+ by the cipher (see PGPGetSymmetricCipherBlockSize()).
+____________________________________________________________________________*/
+PGPError PGPSymmetricCipherEncrypt( PGPSymmetricCipherContextRef ref,
+ const void *in, void *out );
+
+PGPError PGPSymmetricCipherDecrypt( PGPSymmetricCipherContextRef ref,
+ const void *in, void *out );
+
+
+
+
+/*____________________________________________________________________________
+ Determine key and block size for specified algorithm. Stateless routine
+ does not need a context.
+____________________________________________________________________________*/
+PGPError PGPGetSymmetricCipherSizes(
+ PGPSymmetricCipherContextRef ref,
+ PGPSize *keySize , PGPSize *blockSize );
+
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+
+
+#endif /* ] Included_pgpSymmetricCipher_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpTLS.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpTLS.h new file mode 100644 index 0000000000..ec2903aa74 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpTLS.h @@ -0,0 +1,316 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997-1999 Network Associates, Inc.
+ All rights reserved.
+
+ $Id: pgpTLS.h,v 1.32 1999/01/25 11:31:49 wprice Exp $
+____________________________________________________________________________*/
+#ifndef Included_PGPtls_h /* [ */
+#define Included_PGPtls_h
+
+#include "pgpPubTypes.h"
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+
+typedef struct PGPtlsContext * PGPtlsContextRef;
+typedef const struct PGPtlsContext * PGPtlsConstContextRef;
+
+#define kInvalidPGPtlsContextRef ((PGPtlsContextRef) NULL)
+#define PGPtlsContextRefIsValid( ref ) ( (ref) != kInvalidPGPtlsContextRef )
+
+typedef struct PGPtlsSession * PGPtlsSessionRef;
+typedef const struct PGPtlsSession * PGPtlsConstSessionRef;
+
+#define kInvalidPGPtlsSessionRef ((PGPtlsSessionRef) NULL)
+#define PGPtlsSessionRefIsValid( ref ) ( (ref) != kInvalidPGPtlsSessionRef )
+
+
+typedef PGPFlags PGPtlsFlags;
+#define kPGPtlsFlags_ServerSide 0x01
+#define kPGPtlsFlags_ClientSide 0x02
+#define kPGPtlsFlags_RequestClientCert 0x04
+#define kPGPtlsFlags_NonBlockingIO 0x08
+
+enum PGPtlsCipherSuiteNum_
+{
+ kPGPtls_TLS_NULL_WITH_NULL_NULL = 0,
+ kPGPtls_TLS_PGP_DHE_DSS_WITH_CAST_CBC_SHA = 1,
+ kPGPtls_TLS_PGP_DHE_RSA_WITH_CAST_CBC_SHA = 2,
+ kPGPtls_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 3,
+ kPGPtls_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 4,
+ kPGPtls_TLS_RSA_WITH_3DES_EDE_CBC_SHA = 5,
+ kPGPtls_TLS_RSA_WITH_IDEA_CBC_SHA = 6,
+ kPGPtls_TLS_PGP_RSA_WITH_CAST_CBC_SHA = 7,
+ kPGPtls_TLS_PGP_DHE_DSS_WITH_NULL_SHA = 8,
+ kPGPtls_TLS_DHE_DSS_WITH_NULL_SHA = 9,
+
+ PGP_ENUM_FORCE( PGPtlsCipherSuiteNum_ )
+};
+PGPENUM_TYPEDEF( PGPtlsCipherSuiteNum_, PGPtlsCipherSuiteNum );
+
+enum PGPtlsProtocolState_
+{
+ kPGPtls_IdleState = 0,
+ kPGPtls_FatalErrorState = 1,
+ kPGPtls_ClosedState = 2,
+ kPGPtls_HandshakeState = 3,
+ kPGPtls_ReadyState = 4,
+
+ PGP_ENUM_FORCE( PGPtlsProtocolState_ )
+};
+PGPENUM_TYPEDEF( PGPtlsProtocolState_, PGPtlsProtocolState );
+
+enum PGPtlsPrime_
+{
+ kPGPtls_DHPrime1024 = 0,
+ kPGPtls_DHPrime1536 = 1,
+ kPGPtls_DHPrime2048 = 2,
+ kPGPtls_DHPrime3072 = 3,
+ kPGPtls_DHPrime4096 = 4,
+
+ PGP_ENUM_FORCE( PGPtlsPrime_ )
+};
+PGPENUM_TYPEDEF( PGPtlsPrime_, PGPtlsPrime );
+
+enum PGPtlsAlert_
+{
+ kPGPtls_AT_CloseNotify = 0,
+ kPGPtls_AT_UnexpectedMessage = 10, /* FATAL */
+ kPGPtls_AT_BadRecordMAC = 20, /* FATAL */
+ kPGPtls_AT_DecryptionFailed = 21, /* FATAL */
+ kPGPtls_AT_RecordOverflow = 22, /* FATAL */
+ kPGPtls_AT_DecompressionFailure = 30, /* FATAL */
+ kPGPtls_AT_HandshakeFailure = 40, /* FATAL */
+ kPGPtls_AT_NoCertificate = 41, /* SSL3 */
+ kPGPtls_AT_BadCertificate = 42,
+ kPGPtls_AT_UnsupportedCert = 43,
+ kPGPtls_AT_CertRevoked = 44,
+ kPGPtls_AT_CertExpired = 45,
+ kPGPtls_AT_CertUnknown = 46,
+ kPGPtls_AT_IllegalParameter = 47, /* FATAL */
+ kPGPtls_AT_UnknownCA = 48, /* FATAL */
+ kPGPtls_AT_AccessDenied = 49, /* FATAL */
+ kPGPtls_AT_DecodeError = 50, /* FATAL */
+ kPGPtls_AT_DecryptError = 51,
+ kPGPtls_AT_ExportRestriction = 60, /* FATAL */
+ kPGPtls_AT_ProtocolVersion = 70, /* FATAL */
+ kPGPtls_AT_InsufficientSecurity = 71, /* FATAL */
+ kPGPtls_AT_InternalError = 80, /* FATAL */
+ kPGPtls_AT_UserCancelled = 90,
+ kPGPtls_AT_NoRenegotiation = 100,
+
+ kPGPtls_AT_None = 255,
+
+ PGP_ENUM_FORCE( PGPtlsAlert_ )
+};
+PGPENUM_TYPEDEF( PGPtlsAlert_, PGPtlsAlert );
+
+/* The Send and Receive function pointers should return
+ kPGPError_TLSWouldBlock when the socket is non-blocking and the
+ call would block. The Send and Receive functions passed in will
+ need to translate the platform-specific socket error in appropriate
+ cases by using calls such as WSAGetLastError() on Win32. Remember
+ to call PGPtlsSendQueueIdle for non-blocking sockets also if
+ kPGPError_TLSWouldBlock is returned from a send on a non-blocking
+ socket. */
+
+typedef PGPInt32 (* PGPtlsReceiveProcPtr)(void *inData, void *outBuffer,
+ PGPInt32 inBufferSize);
+typedef PGPInt32 (* PGPtlsSendProcPtr)(void *inData, const void *inBuffer,
+ PGPInt32 inBufferLength);
+
+
+PGPError PGPNewTLSContext( PGPContextRef context,
+ PGPtlsContextRef *outRef );
+
+PGPError PGPFreeTLSContext( PGPtlsContextRef ref );
+
+/*____________________________________________________________________________
+ The following function activates or deactivates the session key cache
+ for TLS sessions. This defaults to on but can be deactivated with this
+ function to force all connections to proceed through the entire
+ handshake.
+____________________________________________________________________________*/
+PGPError PGPtlsSetCache( PGPtlsContextRef ref, PGPBoolean useCache );
+
+PGPError PGPtlsClearCache( PGPtlsContextRef ref );
+
+PGPError PGPNewTLSSession( PGPtlsContextRef ref,
+ PGPtlsSessionRef *outRef );
+
+PGPError PGPFreeTLSSession( PGPtlsSessionRef ref );
+
+PGPError PGPCopyTLSSession( PGPtlsSessionRef ref, PGPtlsSessionRef *outRef );
+
+/* Default options are client side and no client cert request */
+PGPError PGPtlsSetProtocolOptions( PGPtlsSessionRef ref,
+ PGPtlsFlags options );
+
+
+/*____________________________________________________________________________
+ The following function must be called to cleanly close a TLS
+ connection. If it is not called, the session will not be able
+ to be resumed from the session cache.
+
+ In the event the application determines any problem with the
+ connection such as the remote key not being valid, call this
+ function with dontCache set to true in order to not cache the
+ session keys.
+____________________________________________________________________________*/
+PGPError PGPtlsClose( PGPtlsSessionRef ref,
+ PGPBoolean dontCache );
+
+/*____________________________________________________________________________
+ The following function must be called to initiate the PGPtls session.
+ Once a TLS session has been assigned to a socket, no data can be sent
+ over that socket by the application until the handshake is completed.
+ Handshake completion is indicated by completion of this call without
+ error or by checking the state of the PGPtlsSession. It will be
+ kPGPtls_ReadyState when the application layer may send and receive
+ data securely.
+
+ This function performs all negotiation of the TLS connection.
+____________________________________________________________________________*/
+PGPError PGPtlsHandshake( PGPtlsSessionRef ref );
+
+/*____________________________________________________________________________
+ The following function should be called before PGPtlsHandshake.
+ In the general case, the remoteID will be an IP address. This
+ is provided to PGPtls in order to allow it to cache the current
+ session and be able to look it up later. If the remoteID passed
+ into a future session is the same as a previously cached session,
+ PGPtls will attempt to resume the session.
+____________________________________________________________________________*/
+PGPError PGPtlsSetRemoteUniqueID( PGPtlsSessionRef ref,
+ PGPUInt32 remoteID );
+
+/*____________________________________________________________________________
+ The following function sets the local private authenticating key.
+
+ The passphrase and key are retained in memory. By default, no
+ key is specified and a client side session will return no key in the
+ client key exchange message to the server.
+ It is an error not to specify a key on a server side TLS session.
+ This function must be passed either PGPOPassphrase or PGPOPasskeyBuffer.
+ You may pass in just a PGP key, PGP w/ X.509 cert, or both -- and they
+ must be the same -- the cert must be from the key. For an X.509 cert,
+ the inCertChain keyset must contain the keys of all keys in the
+ certificate chain for that certificate up to the root. To disable X.509
+ certs, simply pass nothing (ie. kPGPInvalidSigRef). The inCertChain
+ keyset must remain valid for the lifetime of the TLS connection.
+____________________________________________________________________________*/
+PGPError PGPtlsSetLocalPrivateKey( PGPtlsSessionRef ref,
+ PGPKeyRef inKey,
+ PGPSigRef inX509Cert,
+ PGPKeySetRef inCertChain,
+ PGPOptionListRef firstOption, ... );
+
+/*____________________________________________________________________________
+ The following function sets the preferred cipher suite.
+
+ There is no guarantee that cipher will actually be negotiated,
+ but it will be attempted in preference to others.
+____________________________________________________________________________*/
+PGPError PGPtlsSetPreferredCipherSuite( PGPtlsSessionRef ref,
+ PGPtlsCipherSuiteNum cipher );
+
+/*____________________________________________________________________________
+ The following function sets the desired DH prime.
+
+ The requested primes are drawn from a set of primes hard-coded
+ into PGPtls. New primes can be added in a fully compatible
+ fashion since the server sends the prime to the client, but this
+ version of the API does not support passing in a desired prime. The
+ default prime if this function is not called is kPGPtls_DHPrime2048.
+____________________________________________________________________________*/
+PGPError PGPtlsSetDHPrime( PGPtlsSessionRef ref,
+ PGPtlsPrime prime );
+
+/*____________________________________________________________________________
+ The following function gets the authenticated remote key after a
+ successful handshake. You must call this function after a successful
+ handshake to verify that the remote key is authorized to make the
+ connection.
+____________________________________________________________________________*/
+PGPError PGPtlsGetRemoteAuthenticatedKey( PGPtlsSessionRef ref,
+ PGPKeyRef * outKey,
+ PGPKeySetRef * outKeySet );
+
+/*____________________________________________________________________________
+ The following function returns the negotiated symmetric cipher.
+
+ This function will return an error if called before a successful
+ handshake.
+____________________________________________________________________________*/
+PGPError PGPtlsGetNegotiatedCipherSuite( PGPtlsSessionRef ref,
+ PGPtlsCipherSuiteNum *outCipher );
+
+PGPError PGPtlsGetState( PGPtlsSessionRef ref,
+ PGPtlsProtocolState *outState );
+
+/*____________________________________________________________________________
+ The following two functions process data through TLS.
+
+ It is an error to call these functions without having set a
+ Read function pointer or Write function pointer. Most applications
+ will never need to use these functions as the function pointers
+ are automatically configured by PGPsockets, and these functions
+ are automatically called by the PGPsockets implementations of
+ PGPWrite and PGPRead whenever a PGPtlsSessionRef has been set for
+ a given socket.
+____________________________________________________________________________*/
+PGPError PGPtlsReceive( PGPtlsSessionRef ref,
+ void * outBuffer,
+ PGPSize * bufferSize );
+
+PGPError PGPtlsSend( PGPtlsSessionRef ref,
+ const void * inBuffer,
+ PGPSize inBufferLength );
+
+PGPError PGPtlsSetReceiveCallback( PGPtlsSessionRef ref,
+ PGPtlsReceiveProcPtr tlsReceiveProc,
+ void * inData );
+
+PGPError PGPtlsSetSendCallback( PGPtlsSessionRef ref,
+ PGPtlsSendProcPtr tlsSendProc,
+ void * inData );
+
+
+/*____________________________________________________________________________
+ The following function is necessary *only* on a non-blocking socket.
+ If a call to PGPtlsSend returns kPGPError_TLSWouldBlock, call
+ the following function repeatedly until that error is no longer
+ returned in order to make sure data is sent. Another call to
+ PGPtlsSend will also call this function automatically and queue
+ any new data if necessary.
+____________________________________________________________________________*/
+PGPError PGPtlsSendQueueIdle( PGPtlsSessionRef ref );
+
+PGPSize PGPtlsReceiveBufferSize( PGPtlsSessionRef ref );
+
+/*____________________________________________________________________________
+ The following function gets the ID of the fatal alert which caused
+ the TLS session to abort and go into the kPGPtls_FatalErrorState.
+____________________________________________________________________________*/
+PGPError PGPtlsGetAlert( PGPtlsSessionRef ref, PGPtlsAlert *outAlert );
+
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_PGPtls_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpUserInterface.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpUserInterface.h new file mode 100644 index 0000000000..8d2e05db40 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpUserInterface.h @@ -0,0 +1,290 @@ +/*____________________________________________________________________________
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ This file contains the prototypes for functions which use UI to interact
+ with the user.
+
+ $Id: pgpUserInterface.h,v 1.40 1999/03/10 02:59:37 heller Exp $
+____________________________________________________________________________*/
+
+#ifndef Included_pgpUserInterface_h /* [ */
+#define Included_pgpUserInterface_h
+
+#include "pgpPubTypes.h"
+#include "pgpGroups.h"
+
+#if PGP_WIN32
+#include "windows.h"
+#endif
+
+PGP_BEGIN_C_DECLARATIONS
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=mac68k
+#endif
+
+enum PGPAdditionalRecipientRequestEnforcement_
+{
+ kPGPARREnforcement_Invalid = 0,
+ kPGPARREnforcement_None = 1,
+ kPGPARREnforcement_Warn = 2,
+ kPGPARREnforcement_Strict = 3,
+
+ PGP_ENUM_FORCE( PGPAdditionalRecipientRequestEnforcement_ )
+};
+PGPENUM_TYPEDEF( PGPAdditionalRecipientRequestEnforcement_,
+ PGPAdditionalRecipientRequestEnforcement );
+
+enum PGPRecipientSpecType_
+{
+ kPGPRecipientSpecType_Invalid = 0,
+ kPGPRecipientSpecType_Key = 1,
+ kPGPRecipientSpecType_UserID = 2,
+ kPGPRecipientSpecType_KeyID = 3,
+
+ PGP_ENUM_FORCE( PGPRecipientSpecType_ )
+};
+PGPENUM_TYPEDEF( PGPRecipientSpecType_, PGPRecipientSpecType );
+
+typedef struct PGPRecipientSpec
+{
+ PGPRecipientSpecType type;
+ PGPBoolean locked;
+ PGPBoolean reserved8[3]; /* Must be zero */
+ PGPUInt32 reserved32[3]; /* Must be zero */
+
+ union
+ {
+ PGPKeyRef key;
+ char userIDStr[256]; /* Null terminated string */
+
+ struct
+ {
+ PGPKeyID keyID;
+ PGPPublicKeyAlgorithm algorithm;
+ } id;
+
+ } u;
+
+} PGPRecipientSpec;
+
+typedef struct PGPKeyServerSpec
+{
+ PGPKeyServerRef server;
+ const char *serverName; /* Optional */
+ PGPUInt32 reserved[5]; /* Must be zero */
+
+} PGPKeyServerSpec;
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=reset
+#endif
+
+PGPError PGPRecipientDialog(
+ PGPContextRef context,
+ PGPKeySetRef allKeys,
+ PGPBoolean alwaysDisplayDialog,
+ PGPKeySetRef *recipientKeys,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPPassphraseDialog(
+ PGPContextRef context,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPConfirmationPassphraseDialog(
+ PGPContextRef context,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPKeyPassphraseDialog(
+ PGPContextRef context,
+ PGPKeyRef theKey,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPSigningPassphraseDialog(
+ PGPContextRef context,
+ PGPKeySetRef allKeys,
+ PGPKeyRef *signingKey,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPDecryptionPassphraseDialog(
+ PGPContextRef context,
+ PGPKeySetRef recipientKeys,
+ PGPUInt32 keyIDCount,
+ const PGPKeyID keyIDList[],
+ PGPKeyRef *decryptionKey,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPConventionalEncryptionPassphraseDialog(
+ PGPContextRef context,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPConventionalDecryptionPassphraseDialog(
+ PGPContextRef context,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPOptionsDialog(
+ PGPContextRef context,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPCollectRandomDataDialog(
+ PGPContextRef context,
+ PGPUInt32 neededEntropyBits,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPSearchKeyServerDialog(
+ PGPContextRef context,
+ PGPUInt32 serverCount,
+ const PGPKeyServerSpec serverList[],
+ PGPtlsContextRef tlsContext,
+ PGPBoolean searchAllServers,
+ PGPKeySetRef *foundKeys,
+ PGPOptionListRef firstOption, ... );
+
+PGPError PGPSendToKeyServerDialog(
+ PGPContextRef context,
+ const PGPKeyServerSpec *server,
+ PGPtlsContextRef tlsContext,
+ PGPKeySetRef keysToSend,
+ PGPKeySetRef *failedKeys,
+ PGPOptionListRef firstOption, ... );
+
+/*
+** Returns a value in the range 0-100 which crudely estimates
+** the "quality" of a passphrase.
+*/
+
+PGPUInt32 PGPEstimatePassphraseQuality(const char *passphrase);
+
+/* General dialog options */
+
+PGPOptionListRef PGPOUIDialogPrompt(PGPContextRef context,
+ const char *prompt);
+
+PGPOptionListRef PGPOUIWindowTitle(PGPContextRef context,
+ const char *title);
+
+PGPOptionListRef PGPOUIDialogOptions(PGPContextRef context,
+ PGPOptionListRef firstOption, ...);
+
+#if PGP_WIN32
+PGPOptionListRef PGPOUIParentWindowHandle(PGPContextRef context,
+ HWND hwndParent);
+#endif
+
+/* All passphrase dialogs */
+
+/* Caller should free passphrase with PGPFreeData() */
+PGPOptionListRef PGPOUIOutputPassphrase(PGPContextRef context,
+ char **passphrase);
+
+PGPOptionListRef PGPOUIMinimumPassphraseQuality(PGPContextRef context,
+ PGPUInt32 minimumPassphraseQuality);
+
+PGPOptionListRef PGPOUIMinimumPassphraseLength(PGPContextRef context,
+ PGPUInt32 minimumPassphraseLength);
+
+/* PGPConfirmationPassphraseDialog() options */
+
+PGPOptionListRef PGPOUIShowPassphraseQuality(PGPContextRef context,
+ PGPBoolean showPassphraseQuality);
+
+/* PGPSigningPassphraseDialog() and PGPDecryptionPassphraseDialog() options */
+
+PGPOptionListRef PGPOUIDefaultKey(PGPContextRef context,
+ PGPKeyRef defaultKey);
+
+PGPOptionListRef PGPOUIVerifyPassphrase(PGPContextRef context,
+ PGPBoolean verifyPassphrase);
+
+PGPOptionListRef PGPOUIFindMatchingKey(PGPContextRef context,
+ PGPBoolean findMatchingKey);
+
+PGPOptionListRef PGPOUITextUI(PGPContextRef context, PGPBoolean textUI);
+
+/* PGPRecipientDialog() options: */
+
+PGPOptionListRef PGPOUIRecipientList(PGPContextRef context,
+ PGPUInt32 *recipientCount,
+ PGPRecipientSpec **recipientList);
+
+PGPOptionListRef PGPOUIDefaultRecipients(PGPContextRef context,
+ PGPUInt32 recipientCount,
+ const PGPRecipientSpec recipientList[]);
+
+PGPOptionListRef PGPOUIDisplayMarginalValidity(PGPContextRef context,
+ PGPBoolean displayMarginalValidity);
+
+PGPOptionListRef PGPOUIIgnoreMarginalValidity(PGPContextRef context,
+ PGPBoolean ignoreMarginalValidity);
+
+PGPOptionListRef PGPOUIRecipientGroups(PGPContextRef context,
+ PGPGroupSetRef groupSet);
+
+PGPOptionListRef PGPOUIEnforceAdditionalRecipientRequests(
+ PGPContextRef context,
+ PGPAdditionalRecipientRequestEnforcement enforcement,
+ PGPBoolean alwaysDisplayDialogWithARRs);
+
+/* PGPDecryptionPassphraseDialog() and PGPRecipientDialog() only: */
+
+PGPOptionListRef PGPOUIKeyServerUpdateParams(PGPContextRef context,
+ PGPUInt32 serverCount,
+ const PGPKeyServerSpec serverList[],
+ PGPtlsContextRef tlsContext,
+ PGPBoolean searchBeforeDisplay,
+ PGPKeySetRef *foundKeys,
+ PGPOptionListRef firstOption, ...);
+
+/* Key server search dialog options */
+
+PGPOptionListRef PGPOUIKeyServerSearchFilter(PGPContextRef context,
+ PGPFilterRef filter);
+
+PGPOptionListRef PGPOUIKeyServerSearchKey(PGPContextRef context,
+ PGPKeyRef key);
+
+PGPOptionListRef PGPOUIKeyServerSearchKeySet(PGPContextRef context,
+ PGPKeySetRef keySet);
+
+PGPOptionListRef PGPOUIKeyServerSearchKeyIDList(PGPContextRef context,
+ PGPUInt32 keyIDCount, const PGPKeyID keyIDList[] );
+
+/*
+** These options are used to build the options dialog and are only
+** applicable for the PGPOptionsDialog() and PGPOUIDialogOptions() calls.
+** The "description" parameters are optional.
+*/
+
+PGPOptionListRef PGPOUICheckbox(PGPContextRef context, PGPUInt32 itemID,
+ const char *title, const char *description,
+ PGPUInt32 initialValue, PGPUInt32 *resultPtr,
+ PGPOptionListRef firstOption, ...);
+
+PGPOptionListRef PGPOUIPopupList(PGPContextRef context, PGPUInt32 itemID,
+ const char *title, const char *description,
+ PGPUInt32 listItemCount, const char *listItems[],
+ PGPUInt32 initialValue, PGPUInt32 *resultPtr,
+ PGPOptionListRef firstOption, ...);
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+
+PGP_END_C_DECLARATIONS
+
+#endif /* ] Included_pgpUserInterface_h */
+
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/include/pgpUtilities.h b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpUtilities.h new file mode 100644 index 0000000000..d92c999cf9 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/include/pgpUtilities.h @@ -0,0 +1,231 @@ +/*____________________________________________________________________________
+ pgpUtilities.h
+
+ Copyright (C) 1997 Network Associates Inc. and affiliated companies.
+ All rights reserved.
+
+ This file contains miscellaneous utility functions needed for the PGPsdk.
+
+ $Id: pgpUtilities.h,v 1.68 1999/03/25 01:46:38 heller Exp $
+____________________________________________________________________________*/
+
+#ifndef Included_pgpUtilities_h /* [ */
+#define Included_pgpUtilities_h
+
+#if PGP_MACINTOSH /* [ */
+#include <Files.h>
+#endif /* ] PGP_MACINTOSH */
+
+#include "pgpPubTypes.h"
+#include "pgpMemoryMgr.h"
+
+#include <time.h>
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=mac68k /* [ */
+#endif
+
+
+#if PGP_MACINTOSH /* [ */
+
+#define kPGPMacFileCreator_Keys 'pgpK'
+#define kPGPMacFileCreator_DecryptedBinary '????'
+#define kPGPMacFileCreator_DecryptedText 'ttxt'
+#define kPGPMacFileCreator_Tools 'pgpM'
+
+#define kPGPMacFileType_ArmorFile 'TEXT'
+#define kPGPMacFileType_EncryptedData 'pgEF'
+#define kPGPMacFileType_SignedData 'pgSF'
+#define kPGPMacFileType_DetachedSig 'pgDS'
+#define kPGPMacFileType_RandomSeed 'pgRS'
+#define kPGPMacFileType_PrivRing 'pgRR'
+#define kPGPMacFileType_PubRing 'pgPR'
+#define kPGPMacFileType_Groups 'pgGR'
+#define kPGPMacFileType_Preferences 'pref'
+#define kPGPMacFileType_DecryptedText 'TEXT'
+#define kPGPMacFileType_DecryptedBinary 'BINA'
+#define kPGPMacFileType_KeyShares 'pgSK'
+#define kPGPMacFileType_Exported509Keys 'pgX5'
+
+#endif /* ] PGP_MACINTOSH */
+
+PGP_BEGIN_C_DECLARATIONS
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+/*____________________________________________________________________________
+ Context routines
+____________________________________________________________________________*/
+
+/*____________________________________________________________________________
+ API version:
+ Top byte is major, next 3 nibbles minor, next 2 bug fix,
+ last nibble reserved: 0xMMmmmrrR
+
+ example: 1.0.0 = 0x01000000
+
+ 0x01000000 SDK 1.0.0
+ 0x02000000 SDK 1.1.0
+ 0x02000010 SDK 1.1.1
+ 0x03000000 SDK 1.5
+ 0x03000010 SDK 1.5.1
+ 0x03000020 SDK 1.5.2
+ 0x03001000 SDK 1.6
+ 0x03002000 SDK 1.7
+ 0x03002010 SDK 1.7.1
+_____________________________________________________________________________*/
+#define kPGPsdkAPIVersion ( (PGPUInt32)0x03002010 )
+#define PGPMajorVersion( v ) ( ( ((PGPUInt32)(v)) & 0xFF000000 ) >> 24 )
+#define PGPMinorVersion( v ) ( ( ((PGPUInt32)(v)) & 0x00FFF000 ) >> 16 )
+#define PGPRevVersion( v ) ( ( ((PGPUInt32)(v)) & 0x00000FF0 ) >> 4 )
+
+typedef struct PGPNewContextStruct
+{
+ /* sizeofStruct must be inited to sizeof( PGPNewContextStruct ) */
+ PGPUInt32 sizeofStruct;
+ PGPMemoryMgrRef memoryMgr;
+} PGPNewContextStruct;
+
+
+
+/* always pass kPGPsdkVersion */
+PGPError PGPNewContext( PGPUInt32 clientAPIVersion,
+ PGPContextRef *newContext );
+PGPError PGPNewContextCustom( PGPUInt32 clientAPIVersion,
+ PGPNewContextStruct const *custom,
+ PGPContextRef *newContext );
+
+PGPError PGPFreeContext( PGPContextRef context );
+
+PGPError PGPGetContextUserValue( PGPContextRef context,
+ PGPUserValue *userValue );
+PGPError PGPSetContextUserValue( PGPContextRef context,
+ PGPUserValue userValue );
+
+PGPError PGPContextGetRandomBytes(PGPContextRef context,
+ void *buf, PGPSize len );
+
+
+PGPMemoryMgrRef PGPGetContextMemoryMgr( PGPContextRef context );
+
+
+
+/*____________________________________________________________________________
+ FileRefs
+____________________________________________________________________________*/
+
+PGPError PGPCopyFileSpec(PGPFileSpecRef fileRef,
+ PGPFileSpecRef *ref);
+PGPError PGPFreeFileSpec(PGPFileSpecRef fileRef);
+
+#if PGP_MACINTOSH /* [ */
+
+PGPError PGPNewFileSpecFromFSSpec(PGPContextRef context,
+ const FSSpec *spec, PGPFileSpecRef *ref);
+PGPError PGPGetFSSpecFromFileSpec(PGPFileSpecRef fileRef,
+ FSSpec *spec);
+#else
+
+PGPError PGPNewFileSpecFromFullPath( PGPContextRef context,
+ char const *path, PGPFileSpecRef *ref);
+
+/* *fullPathPtr ***must*** be freed with PGPFreeData */
+PGPError PGPGetFullPathFromFileSpec( PGPFileSpecRef fileRef,
+ char ** fullPathPtr);
+
+#endif /* ] PGP_MACINTOSH */
+
+
+
+/*____________________________________________________________________________
+ Time
+____________________________________________________________________________*/
+PGPTime PGPGetTime(void);
+
+/* these use time_t type as returned by time() in Std C libraries */
+time_t PGPGetStdTimeFromPGPTime(PGPTime theTime);
+PGPTime PGPGetPGPTimeFromStdTime(time_t theTime);
+
+
+/* year, month, day may be NULL if desired */
+void PGPGetYMDFromPGPTime( PGPTime theTime,
+ PGPUInt16 *year, PGPUInt16 *month, PGPUInt16 *day );
+
+
+#if PGP_MACINTOSH /* [ */
+PGPUInt32 PGPTimeToMacTime(PGPTime theTime);
+PGPTime PGPTimeFromMacTime(PGPUInt32 theTime);
+#endif /* ] PGP_MACINTOSH */
+
+
+
+/*____________________________________________________________________________
+ MacBinary support
+____________________________________________________________________________*/
+
+
+/*____________________________________________________________________________
+ Examine the input file to see if it's a MacBinary file. If it is
+ not a MacBinary file, then the original file is unaltered.
+ Otherwise, the file is converted and the original file is deleted.
+
+ The resulting file is designated by 'outPGPSpec' and may have a different
+ name than the original.
+
+ If the file is a TEXT file, appropriate line-end conversion is done.
+
+ creator and type code pointers may be
+ null but otherwise contain the mac creator and type.
+
+ This routine can be called on a Mac, but generally doesn't need to be.
+____________________________________________________________________________*/
+PGPError PGPMacBinaryToLocal( PGPFileSpecRef inSpec,
+ PGPFileSpecRef * outSpec,
+ PGPUInt32 * macCreator, PGPUInt32 * macTypeCode );
+
+
+
+
+/*____________________________________________________________________________
+ Library initialization
+
+ Call PGPsdkXXXInit() before using that particular library.
+ Call PGPsdkXXXCleanup() when you are done (but after disposing of any
+ PGPContexts).
+
+ You may call PGPsdkXXXInit multiple times (with no effect), but be sure
+ to call the matching PGPsdkXXXCleanup() for each call to PGPsdkXXXInit().
+____________________________________________________________________________*/
+
+PGPError PGPsdkInit( void );
+PGPError PGPsdkCleanup( void );
+
+PGPError PGPsdkNetworkLibInit( void );
+PGPError PGPsdkNetworkLibCleanup( void );
+
+PGPError PGPsdkUILibInit( void );
+PGPError PGPsdkUILibCleanup( void );
+
+#if PRAGMA_IMPORT_SUPPORTED
+#pragma import reset
+#endif
+PGP_END_C_DECLARATIONS
+
+
+
+#if PRAGMA_ALIGN_SUPPORTED
+#pragma options align=reset /* ] */
+#endif
+
+#endif /* ] Included_pgpUtilities_h */
+
+/*__Editor_settings____
+
+ Local Variables:
+ tab-width: 4
+ End:
+ vi: ts=4 sw=4
+ vim: si
+_____________________*/
diff --git a/plugins/CryptoPP/src/PGPw/sdk6/lib/PGP_SDK.lib b/plugins/CryptoPP/src/PGPw/sdk6/lib/PGP_SDK.lib Binary files differnew file mode 100644 index 0000000000..9332eae432 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/lib/PGP_SDK.lib diff --git a/plugins/CryptoPP/src/PGPw/sdk6/lib/PGPsdkNL.lib b/plugins/CryptoPP/src/PGPw/sdk6/lib/PGPsdkNL.lib Binary files differnew file mode 100644 index 0000000000..30c53907d9 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/lib/PGPsdkNL.lib diff --git a/plugins/CryptoPP/src/PGPw/sdk6/lib/PGPsdkUI.lib b/plugins/CryptoPP/src/PGPw/sdk6/lib/PGPsdkUI.lib Binary files differnew file mode 100644 index 0000000000..65f6c55e7b --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk6/lib/PGPsdkUI.lib diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pflTypes.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pflTypes.h new file mode 100644 index 0000000000..00f3242fd4 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pflTypes.h @@ -0,0 +1,52 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pflTypes.h,v 1.5 2003/11/20 21:15:48 vinnie Exp $ +____________________________________________________________________________*/ +#ifndef Included_pflTypes_h /* [ */ +#define Included_pflTypes_h + +#include "pgpBase.h" + +/* opaque declarations */ +typedef struct PFLFileSpec * PFLFileSpecRef; +typedef struct PFLFileSpec const * PFLConstFileSpecRef; + +typedef struct PFLDirectoryIter * PFLDirectoryIterRef; +typedef struct PFLDirectoryIter const * PFLConstDirectoryIterRef; + +/* Validity checks */ +#define kInvalidPFLFileSpecRef ((PFLFileSpecRef) NULL) +#define kInvalidPFLDirectoryIterRef ((PFLDirectoryIterRef) NULL) + +#define PFLFileSpecRefIsValid( ref ) ( (ref) != kInvalidPFLFileSpecRef ) +#define PFLDirectoryIterRefIsValid( ref ) \ + ( (ref) != kInvalidPFLDirectoryIterRef ) + +/* Languages supported by pgpLocStrings */ +enum PFLLanguage_ +{ + kPFLLanguage_Default = 0, + kPFLLanguage_English = 1, + kPFLLanguage_Japanese = 2, + kPFLLanguage_German = 3, + kPFLLanguage_Spanish = 4, + + PGP_ENUM_FORCE( PFLLanguage_ ) +}; + +PGPENUM_TYPEDEF( PFLLanguage_, PFLLanguage ); + + +#endif /* ] Included_pflTypes_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpAPIAdapter.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpAPIAdapter.h new file mode 100644 index 0000000000..e473df49e2 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpAPIAdapter.h @@ -0,0 +1,186 @@ +/*____________________________________________________________________________ + * Copyright (C) 2003 PGP Corporation + * All rights reserved. + * + * Size of UTF-16 string is always given in 16 bit characters. This includes + * PGPGetKeyDBObjDataPropertyU16 and PGPGetKeyDBObjAllocatedDataPropertyU16 + * for which void* is assumed to be PGPChar16* where applicable. + * So you can write like this: + * + * wchar_t s[80]; + * PGPSize size; + * PGPGetPrimaryUserIDNameU16( key, s, sizeof(s)/sizeof(s[0]), &size ); + * + * $Id: pgpAPIAdapter.h,v 1.12 2004/05/07 08:29:12 bgaiser Exp $ + *____________________________________________________________________________*/ +#ifndef Included_pgpAPIAdapter_h /* [ */ +#define Included_pgpAPIAdapter_h + +#include "pgpKeys.h" +#include "pgpKeyServer.h" + +#include "pgpMemoryMgr.h" +#include "pgpUtilities.h" +#include "pgpPFLErrors.h" +#include "pgpFileSpec.h" +#include "pgpHashWords.h" +#include "pgpShareFile.h" + +PGP_BEGIN_C_DECLARATIONS + +PGPError PGPGetErrorStringU8( PGPError theError, PGPSize bufferSize, PGPChar8 * theString ); +PGPError PGPGetErrorStringU16( PGPError theError, PGPSize bufferSize, PGPChar16 * theString ); + +PGPError PGPGetPGPsdkVersionStringU8( PGPChar8 versionString[ 256 ] ); +PGPError PGPGetPGPsdkVersionStringU16( PGPChar16 versionString[ 256 ] ); + +PGPError PGPNewFileSpecFromFullPathU8( PGPContextRef context, const PGPChar8 *path, PGPFileSpecRef *ref ); +PGPError PGPNewFileSpecFromFullPathU16( PGPContextRef context, const PGPChar16 *path, PGPFileSpecRef *ref ); + +PGPError PGPGetFullPathFromFileSpecU8( PGPFileSpecRef fileRef, PGPChar8 **fullPathPtr); +PGPError PGPGetFullPathFromFileSpecU16( PGPFileSpecRef fileRef, PGPChar16 **fullPathPtr); + +PGPError PGPRenameFileU8( PGPFileSpecRef fileRef, const PGPChar8 *newName ); +PGPError PGPRenameFileU16( PGPFileSpecRef fileRef, const PGPChar16 *newName ); + +PGPOptionListRef PGPOPassphraseBufferU8( PGPContextRef context, const PGPChar8 *passphrase, PGPSize passphraseLength); +PGPOptionListRef PGPOPassphraseBufferU16( PGPContextRef context, const PGPChar16 *passphrase, PGPSize passphraseLength); + +PGPOptionListRef PGPOPassphraseU8( PGPContextRef context, const PGPChar8 *passphrase); +PGPOptionListRef PGPOPassphraseU16( PGPContextRef context, const PGPChar16 *passphrase); + +PGPOptionListRef PGPOPGPMIMEEncodingU8(PGPContextRef context, PGPBoolean mimeEncoding, PGPSize *mimeBodyOffset, PGPChar8 mimeSeparator[ kPGPMimeSeparatorSize ]); +PGPOptionListRef PGPOPGPMIMEEncodingU16(PGPContextRef context, PGPBoolean mimeEncoding, PGPSize *mimeBodyOffset, PGPChar16 mimeSeparator[ kPGPMimeSeparatorSize ]); + +PGPOptionListRef PGPOKeyGenNameU8( PGPContextRef context, const void *name, PGPSize nameLength ); +PGPOptionListRef PGPOKeyGenNameU16( PGPContextRef context, const void *name, PGPSize nameLength ); + +PGPOptionListRef PGPOPreferredKeyServerU8( PGPContextRef context, PGPChar8 const * server ); +PGPOptionListRef PGPOPreferredKeyServerU16( PGPContextRef context, PGPChar16 const * server ); + +PGPOptionListRef PGPOCommentStringU8( PGPContextRef context,PGPChar8 const *comment); +PGPOptionListRef PGPOCommentStringU16( PGPContextRef context,PGPChar16 const *comment); + +PGPOptionListRef PGPOVersionStringU8( PGPContextRef context, PGPChar8 const *version); +PGPOptionListRef PGPOVersionStringU16( PGPContextRef context, PGPChar16 const *version); + +PGPOptionListRef PGPOFileNameStringU8( PGPContextRef context, PGPChar8 const *fileName); +PGPOptionListRef PGPOFileNameStringU16( PGPContextRef context, PGPChar16 const *fileName); + +PGPOptionListRef PGPOSigRegularExpressionU8(PGPContextRef context, PGPChar8 const *regularExpression); +PGPOptionListRef PGPOSigRegularExpressionU16(PGPContextRef context, PGPChar16 const *regularExpression); + +PGPError PGPGetKeyDBObjDataPropertyU8( PGPKeyDBObjRef key, PGPKeyDBObjProperty whichProperty, void *buffer, PGPSize bufferSize, PGPSize *dataSize); +PGPError PGPGetKeyDBObjDataPropertyU16( PGPKeyDBObjRef key, PGPKeyDBObjProperty whichProperty, void *buffer, PGPSize bufferSize, PGPSize *dataSize); + +PGPError PGPGetKeyDBObjAllocatedDataPropertyU8( PGPKeyDBObjRef obj, PGPKeyDBObjProperty prop, void **buffer, PGPSize *dataSize ); +PGPError PGPGetKeyDBObjAllocatedDataPropertyU16( PGPKeyDBObjRef obj, PGPKeyDBObjProperty prop, void **buffer, PGPSize *dataSize ); + +PGPError PGPNewKeyDBObjDataFilterU8( PGPContextRef context, PGPKeyDBObjProperty prop, const void *val, PGPSize len, PGPMatchCriterion match, PGPFilterRef *outFilter ); +PGPError PGPNewKeyDBObjDataFilterU16( PGPContextRef context, PGPKeyDBObjProperty prop, const void *val, PGPSize len, PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPLDAPQueryFromFilterU8( PGPFilterRef filter, PGPChar8 **queryOut ); +PGPError PGPLDAPQueryFromFilterU16( PGPFilterRef filter, PGPChar16 **queryOut ); + +PGPError PGPLDAPX509QueryFromFilterU8( PGPFilterRef filter,PGPChar8 **queryOut ); +PGPError PGPLDAPX509QueryFromFilterU16( PGPFilterRef filter,PGPChar16 **queryOut ); + +PGPError PGPHKSQueryFromFilterU8( PGPFilterRef filter, PGPChar8 **queryOut ); +PGPError PGPHKSQueryFromFilterU16( PGPFilterRef filter, PGPChar16 **queryOut ); + +PGPError PGPNetToolsCAHTTPQueryFromFilterU8( PGPFilterRef filter, PGPChar8 **queryOut ); +PGPError PGPNetToolsCAHTTPQueryFromFilterU16( PGPFilterRef filter, PGPChar16 **queryOut ); + +PGPError PGPAddUserIDU8( PGPKeyDBObjRef key, PGPChar8 const *userID, PGPOptionListRef firstOption, ...); +PGPError PGPAddUserIDU16( PGPKeyDBObjRef key, PGPChar16 const *userID, PGPOptionListRef firstOption, ...); + +PGPInt32 PGPCompareUserIDStringsU8(PGPChar8 const *a, PGPChar8 const *b); +PGPInt32 PGPCompareUserIDStringsU16(PGPChar16 const *a, PGPChar16 const *b); + +PGPError PGPGetKeyIDStringU8( PGPKeyID const * ref, PGPKeyIDStringType type, PGPChar8 outString[ kPGPMaxKeyIDStringSize ] ); +PGPError PGPGetKeyIDStringU16( PGPKeyID const * ref, PGPKeyIDStringType type, PGPChar16 outString[ kPGPMaxKeyIDStringSize ] ); + +PGPError PGPNewKeyIDFromStringU8( const PGPChar8 *string, PGPPublicKeyAlgorithm pkalg, PGPKeyID * outID ); +PGPError PGPNewKeyIDFromStringU16( const PGPChar16 *string, PGPPublicKeyAlgorithm pkalg, PGPKeyID * outID ); + +PGPError PGPSetPKCS11DrvFileU8( PGPChar8 *module ); +PGPError PGPSetPKCS11DrvFileU16( PGPChar16 *module ); + +PGPError PGPGetTokenInfoDataPropertyU8( PGPContextRef context, PGPUInt32 tokenNumber, PGPTokenProperty prop, PGPByte *value, PGPSize size, PGPSize *sizeout ); +PGPError PGPGetTokenInfoDataPropertyU16( PGPContextRef context, PGPUInt32 tokenNumber, PGPTokenProperty prop, void *value, PGPSize size, PGPSize *sizeout ); + +PGPError PGPCreateDistinguishedNameU8( PGPContextRef context, PGPChar8 const *str, PGPByte **pdname, PGPSize *pdnamelen ); +PGPError PGPCreateDistinguishedNameU16( PGPContextRef context, PGPChar16 const *str, PGPByte **pdname, PGPSize *pdnamelen ); + +PGPError PGPGetPrimaryUserIDNameU8(PGPKeyDBObjRef key, PGPChar8 *buffer, PGPSize bufferSize, PGPSize *dataSize); +PGPError PGPGetPrimaryUserIDNameU16(PGPKeyDBObjRef key, PGPChar16 *buffer, PGPSize bufferSize, PGPSize *dataSize); + +PGPError PGPGetHashWordStringU8( PGPUInt32 index, PGPHashWordList list, PGPChar8 hashWordString[ 12 ] ); +PGPError PGPGetHashWordStringU16( PGPUInt32 index, PGPHashWordList list, PGPChar16 hashWordString[ 12 ] ); + +PGPError PGPSetShareFileUserIDU8( PGPShareFileRef shareFileRef, const PGPUTF8 *userID ); +PGPError PGPSetShareFileUserIDU16( PGPShareFileRef shareFileRef, const PGPChar16 *userID ); + +PGPError PGPGetShareFileUserIDU8( PGPShareFileRef shareFileRef, PGPSize bufferSize, PGPUTF8 *userID, PGPSize *fullSize ); +PGPError PGPGetShareFileUserIDU16( PGPShareFileRef shareFileRef, PGPSize bufferSize, PGPChar16 *userID, PGPSize *fullSize ); + +PGPError PGPGetTARCacheObjDataPropertyU8( PGPTARCacheObjRef obj, PGPTARCacheObjProperty prop, void *buffer, PGPSize bufSize, PGPSize *dataSize ); +PGPError PGPGetTARCacheObjDataPropertyU16( PGPTARCacheObjRef obj, PGPTARCacheObjProperty prop, void *buffer, PGPSize bufSize, PGPSize *dataSize ); + + +/* ----- SDK UI ----- */ +PGPUInt32 PGPEstimatePassphraseQualityU8( const PGPChar8 *passphrase ); +PGPUInt32 PGPEstimatePassphraseQualityU16( const PGPChar16 *passphrase ); + +PGPOptionListRef PGPOUIDialogPromptU8( PGPContextRef context, const PGPChar8 *prompt ); +PGPOptionListRef PGPOUIDialogPromptU16( PGPContextRef context, const PGPChar16 *prompt ); + +PGPOptionListRef PGPOUIWindowTitleU8( PGPContextRef context, const PGPChar8 *title ); +PGPOptionListRef PGPOUIWindowTitleU16( PGPContextRef context, const PGPChar16 *title ); + +PGPOptionListRef PGPOUIOutputPassphraseU8( PGPContextRef context, PGPChar8 **passphrase ); +PGPOptionListRef PGPOUIOutputPassphraseU16( PGPContextRef context, PGPChar16 **passphrase ); + +PGPOptionListRef PGPOUICheckboxU8(PGPContextRef context, PGPUInt32 itemID, const PGPChar8 *title, const PGPChar8 *description, PGPUInt32 initialValue, PGPUInt32 *resultPtr, PGPOptionListRef firstOption, ...); +PGPOptionListRef PGPOUICheckboxU16(PGPContextRef context, PGPUInt32 itemID, const PGPChar16 *title, const PGPChar16 *description, PGPUInt32 initialValue, PGPUInt32 *resultPtr, PGPOptionListRef firstOption, ...); + +PGPOptionListRef PGPOUIPopupListU8(PGPContextRef context, PGPUInt32 itemID, const PGPChar8 *title, const PGPChar8 *description,PGPUInt32 listItemCount, const PGPChar16 *listItems[], PGPUInt32 initialValue, PGPUInt32 *resultPtr, PGPOptionListRef firstOption, ...); +PGPOptionListRef PGPOUIPopupListU16(PGPContextRef context, PGPUInt32 itemID, const PGPChar16 *title, const PGPChar16 *description,PGPUInt32 listItemCount, const PGPChar16 *listItems[], PGPUInt32 initialValue, PGPUInt32 *resultPtr, PGPOptionListRef firstOption, ...); + + +/* ----- SDK Network ----- */ +PGPOptionListRef PGPONetURLU8(PGPContextRef context, const PGPChar8 *url); +PGPOptionListRef PGPONetURLU16(PGPContextRef context, const PGPChar16 *url); + +PGPOptionListRef PGPONetHostNameU8(PGPContextRef context, const PGPChar8 *hostName, PGPUInt16 port); +PGPOptionListRef PGPONetHostNameU16(PGPContextRef context, const PGPChar16 *hostName, PGPUInt16 port); + +PGPOptionListRef PGPOKeyServerKeyStoreDNU8(PGPContextRef context, const PGPChar8 *szKeyStoreDn); +PGPOptionListRef PGPOKeyServerKeyStoreDNU16(PGPContextRef context, const PGPChar16 *szKeyStoreDn); + +PGPError PGPGetKeyServerHostNameU8(PGPKeyServerRef inKeyServerRef, PGPChar8 ** outHostName); /* Use PGPFreeData to free */ +PGPError PGPGetKeyServerHostNameU16(PGPKeyServerRef inKeyServerRef, PGPChar16 ** outHostName); /* Use PGPFreeData to free */ + +PGPError PGPGetKeyServerPathU8(PGPKeyServerRef inKeyServerRef, PGPChar8 ** outPath); /* Use PGPFreeData to free */ +PGPError PGPGetKeyServerPathU16(PGPKeyServerRef inKeyServerRef, PGPChar16 ** outPath); /* Use PGPFreeData to free */ + +PGPError PGPGetLastKeyServerErrorStringU8(PGPKeyServerRef inKeyServerRef,PGPChar8 ** outErrorString); +PGPError PGPGetLastKeyServerErrorStringU16(PGPKeyServerRef inKeyServerRef,PGPChar16 ** outErrorString); + +PGPError PGPGetProxyServerU8(PGPContextRef context, PGPProxyServerType type, PGPChar8 **proxyAddress, PGPUInt16 *proxyPort ); +PGPError PGPGetProxyServerU16(PGPContextRef context, PGPProxyServerType type, PGPChar16 **proxyAddress, PGPUInt16 *proxyPort ); + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpAPIAdapter_h */ + + +/*__Editor_settings____ + * + * Local Variables: + * tab-width: 4 + * End: + * vi: ts=4 sw=4 + * vim: si + *_____________________*/ + diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBER.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBER.h new file mode 100644 index 0000000000..ad20d033fd --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBER.h @@ -0,0 +1,175 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpBER.h,v 1.15 2003/08/08 04:40:39 ajivsov Exp $ +____________________________________________________________________________*/ + +/* + * For extremely detailed explanation of all the BER types and + * encoding, see X.208 (Specification of Abstract Syntax Notation One (ASN.1)) + * and X.209 (Specification of Basic Encoding Rules for Abstract Syntax + * Notation One (ASN.1)). + * + * These two sources will tell you everything you would ever need (and want) + * to know about BER and ASN.1. + */ + +#ifndef Included_pgpBER_h /* [ */ +#define Included_pgpBER_h + +#include "pgpPubTypes.h" +#include "pgpMemoryMgr.h" +#include "pgpSockets.h" + +/* BER types */ +/* The X.209 BER specification actually defines a lot more + * types than is listed here, but these are the only ones + * the current PGPldap implementation uses. */ +enum PGPberType_ +{ + kPGPberType_Boolean = 0x01, /* tag = 0x01 */ + kPGPberType_Int = 0x02, /* tag = 0x02 */ + kPGPberType_Bitstring = 0x03, /* tag = 0x03 */ + kPGPberType_Octetstring = 0x04, /* tag = 0x04 */ + kPGPberType_NULL = 0x05, /* tag = 0x05 */ + kPGPberType_ObjectID = 0x06, /* tag = 0x06 */ + kPGPberType_Enumeration = 0x0A, /* tag = 0x0A */ + kPGPberType_PrintableString = 0x0D, /* tag = 0x0D */ + kPGPberType_Sequence = 0x30, /* constructed, tag = 0x10 */ + kPGPberType_Set = 0x31, /* constructed, tag = 0x11 */ + + kPGPberType_None = 0xFFFFFFFF +}; +PGPENUM_TYPEDEF (PGPberType_, PGPberType); + +enum PGPberFormatSpecifier_ +{ + kPGPberFormatSpecifier_Boolean = 'b', + kPGPberFormatSpecifier_Int = 'i', + kPGPberFormatSpecifier_Octetstring = 'o', + kPGPberFormatSpecifier_String = 's', + kPGPberFormatSpecifier_StringVector = 'v', + kPGPberFormatSpecifier_BERVector = 'V', /* strings and lengths */ + kPGPberFormatSpecifier_NULL = 'n', + kPGPberFormatSpecifier_Enumeration = 'e', + kPGPberFormatSpecifier_Tag = 't', + kPGPberFormatSpecifier_BeginSequence= '{', + kPGPberFormatSpecifier_EndSequence = '}', + kPGPberFormatSpecifier_BeginSet = '[', + kPGPberFormatSpecifier_EndSet = ']', + + kPGPberFormatSpecifier_Force = '*' +}; +PGPENUM_TYPEDEF (PGPberFormatSpecifier_, PGPberFormatSpecifier); + + +typedef struct PGPberElement * PGPberElementRef; + +#define kInvalidPGPberElementRef ( (PGPberElementRef) NULL) +#define PGPberElementRefIsValid(ber) \ + ( (ber) != kInvalidPGPberElementRef ) +#define PGPValidateBERElementRef(ber) \ + PGPValidateParam( PGPberElementRefIsValid( ber ) ) + +typedef struct PGPberValue +{ + PGPSize length; + PGPByte *value; +} PGPberValue; + +/* Functions */ + + PGPError +PGPNewBERElement( + PGPContextRef context, + PGPberElementRef * ber ); + +/* ber_free */ + PGPError +PGPFreeBERElement( + PGPberElementRef ber ); + +/* BER encoding functions */ + PGPError +PGPberAppend( + PGPberElementRef ber, + const PGPChar8 * s, + ... ); + + PGPError +PGPberGetEncoding( + PGPberElementRef ber, + PGPByte ** encoding ); + +/* BER decoding functions */ + PGPError +PGPberRead( + PGPberElementRef ber, + const PGPChar8 * fmt, + ... ); + + PGPError +PGPberGetLength( + PGPberElementRef ber, + PGPSize * length ); + + PGPError +PGPberRewind( + PGPberElementRef ber ); + + PGPError +PGPberNextPrimitive( + PGPberElementRef ber ); + + PGPError +PGPberNextConstructed( + PGPberElementRef ber ); + + PGPError +PGPberNext( + PGPberElementRef ber ); + + PGPError +PGPberSkip( + PGPberElementRef ber ); + + PGPError +PGPberPeek( + PGPberElementRef ber, + PGPberType * tag, + PGPSize * len ); + + PGPError +PGPberGetIndex( + PGPberElementRef ber, + PGPUInt32 * index ); + + PGPError +PGPberSetIndex( + PGPberElementRef ber, + PGPUInt32 index ); + + PGPError +PGPberReadResponse( + PGPberElementRef ber, + PGPSocketRef sock ); + + PGPError +PGPberSetData( + PGPberElementRef ber, + PGPByte * data, + PGPSize len ); + + +#endif /* ] Included_pgpBER_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBase.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBase.h new file mode 100644 index 0000000000..53a1df46e7 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBase.h @@ -0,0 +1,451 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + This file deals with system dependencies to derive our very basic data + types. It should not contain any higher level types. + + + $Id: pgpBase.h,v 1.30 2004/02/09 23:30:31 vinnie Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpBase_h /* [ */ +#define Included_pgpBase_h + +#include "pgpPFLConfig.h" + +#if !( defined(PGP_MACINTOSH) || defined(PGP_UNIX) || defined(PGP_WIN32) ) +#error one of {PGP_MACINTOSH, PGP_UNIX, PGP_WIN32} must be defined +#endif + +#if PGP_MACINTOSH +#include <stddef.h> +#if __MWERKS__ && ! defined( __dest_os ) + #include <ansi_parms.h> + #define __dest_os __mac_os +#endif +#else + /* aCC bars on <sys/time.h> if this file is not included first */ + #if PGP_COMPILER_HPUX + #include <sys/sigevent.h> + #endif /* PGP_COMPILER_HPUX */ + #include <sys/types.h> +#endif + +#if PGP_WIN32 +#include <stddef.h> /* For size_t */ +#endif + +#if ! NO_LIMITS_H +#include <limits.h> +#endif + +#ifndef PGP_UNICODE +#define PGP_UNICODE 0 +#endif + +#if PGP_WIN32 + /* check for inconsistent usage of UNICODE symbols */ + #if PGP_UNICODE + #if !defined(UNICODE) || !defined(_UNICODE) + #error UNICODE and _UNICODE must be defined + #endif + #else + #if defined(UNICODE) || defined(_UNICODE) + #error UNICODE and _UNICODE should not be defined + #endif + #endif +#endif + + +/*____________________________________________________________________________ + PGP basic types +____________________________________________________________________________*/ + +typedef unsigned char PGPBoolean; /* can be TRUE or FALSE */ + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +/* PGPUInt8, PGPInt8 */ +#if UCHAR_MAX == 0xff + +typedef unsigned char PGPUInt8; +typedef signed char PGPInt8; +#define MAX_PGPUInt8 UCHAR_MAX +#define MAX_PGPInt8 SCHAR_MAX + +#else +#error This machine has no 8-bit type +#endif + + +/* PGPUInt16, PGPInt16 */ +#if UINT_MAX == 0xffff + +typedef unsigned int PGPUInt16; +typedef int PGPInt16; +#define MAX_PGPUInt16 UINT_MAX +#define MAX_PGPInt16 INT_MAX + +#elif USHRT_MAX == 0xffff + +typedef unsigned short PGPUInt16; +typedef short PGPInt16; +#define MAX_PGPUInt16 USHRT_MAX +#define MAX_PGPInt16 SHRT_MAX + +#else +#error This machine has no 16-bit type +#endif + + +/* PGPUInt32, PGPInt32 */ +#if UINT_MAX == 0xfffffffful + +typedef unsigned int PGPUInt32; +typedef int PGPInt32; +#define MAX_PGPUInt32 UINT_MAX +#define MAX_PGPInt32 INT_MAX + +#elif ULONG_MAX == 0xfffffffful + +typedef unsigned long PGPUInt32; +typedef long PGPInt32; +#define MAX_PGPUInt32 ULONG_MAX +#define MAX_PGPInt32 LONG_MAX + +#elif USHRT_MAX == 0xfffffffful + +typedef unsigned short PGPUInt32; +typedef short PGPInt32; +#define MAX_PGPUInt32 USHRT_MAX +#define MAX_PGPInt32 SHRT_MAX + +#else +#error This machine has no 32-bit type +#endif + + +/*____________________________________________________________________________ + PGPUInt64, PGPInt64 + + Find a 64-bit data type, if possible. + The conditions here are more complicated to avoid using numbers that + will choke lesser preprocessors (like 0xffffffffffffffff) unless + we're reasonably certain that they'll be acceptable. + + Some *preprocessors* choke on constants that long even if the + compiler can accept them, so it doesn't work reliably to test values. + So cross our fingers and hope that it's a 64-bit type. + + GCC uses ULONG_LONG_MAX. Solaris uses ULLONG_MAX. + IRIX uses ULONGLONG_MAX. Are there any other names for this? +____________________________________________________________________________*/ + + +#if ULONG_MAX > 0xfffffffful +#if ULONG_MAX == 0xfffffffffffffffful + +typedef ulong PGPUInt64; +typedef long PGPInt64; +#define PGP_HAVE64 1 + +#endif +#endif + + +#ifndef PGP_HAVE64 + +#if defined(ULONG_LONG_MAX) || defined (ULLONG_MAX) || defined(ULONGLONG_MAX) || defined(__LONG_LONG_MAX__) +typedef unsigned long long PGPUInt64; +typedef long long PGPInt64; +#define PGP_HAVE64 1 + +#endif +#endif + +/*____________________________________________________________________________ + This was added because for some reason or another, __LONG_LONG_MAX__ is + not defined on Linux 6.1. Hopefully this doesn't break older versions of + Linux but you never know..... +____________________________________________________________________________*/ +#if defined(PGP_UNIX_LINUX) && !defined(PGP_HAVE64) +typedef long long PGPInt64; +typedef unsigned long long PGPUInt64; +#define PGP_HAVE64 1 +#endif + + +#ifndef PGP_HAVE64 +#if defined(__MWERKS__) +#if __option( longlong ) + +typedef unsigned long long PGPUInt64; +typedef long long PGPInt64; +#define PGP_HAVE64 1 + +#endif +#endif +#endif + +#if PGP_HAVE64 +/* too painful to test all the variants above, so just do it this way */ +#define MAX_PGPUInt64 ((PGPUInt64)0xfffffffffffffffful) +#define MAX_PGPInt64 ((PGPInt64)0x7fffffffffffffff) +#endif + + +/*____________________________________________________________________________ + PGPInt, PGPUInt, PGPLong, PGPULong + + Architecture-specific data types. + + PGPLong will be 64 bits on 64-bit architectures (Linux on AMD64 or WIN64). + PGPLong is hardware-supported integeral type such that + sizeof(PGPULong)==sizeof(void*) + + PGPInt is the most efficient harware-supported integeral type that is at + least 32 bit long. It should be the main type for internal counters, sizes, + offsets etc unless possibly the larger space of PGPSize is required. +____________________________________________________________________________*/ + +/* note that this should be changed for 16 bit platform */ +typedef int PGPInt; +typedef unsigned int PGPUInt; + +#if PGP_WIN32 + #if defined(_WIN64) + #if PGP_HAVE_64_HARDWARE==0 + #error "Configuration error: PGP_HAVE_64_HARDWARE must be 1 for WIN64" + #endif + typedef __int64 PGPLong; + typedef unsigned __int64 PGPULong; + #else + #ifndef _W64 + /* (this definition is only need for WINNT) */ + #define _W64 + #endif + typedef _W64 __int32 PGPLong; + typedef _W64 unsigned __int32 PGPULong; + #endif +#else + typedef unsigned long PGPULong; + typedef long PGPLong; +#endif + +#if INT_MAX == 0x7FFFFFFFL +#define PGPENUM_TYPEDEF( enumName, typeName ) typedef enum enumName typeName +#else +#define PGPENUM_TYPEDEF( enumName, typeName ) typedef PGPInt32 typeName +#endif +#define kPGPEnumMaxValue INT_MAX + +#define PGP_ENUM_FORCE( enumName ) \ + k ## enumName ## force = kPGPEnumMaxValue + + +typedef PGPUInt8 PGPByte; + +typedef PGPInt32 PGPError; + +/* a simple value sufficient to hold any numeric or pointer type */ +typedef void * PGPUserValue; + +/* A PGPSize refers to in memory sizes. Use PGPFileOffset for file offsets */ +typedef size_t PGPSize; +#define MAX_PGPSize ( ~(PGPSize)0 ) + +/* An offset or size of a file */ +#if PGP_UNIX +#ifdef HAVE_64BIT_FILES +typedef off64_t PGPFileOffset; +#else /* !HAVE_64BIT_FILES */ +typedef off_t PGPFileOffset; +#endif /* HAVE_64BIT_FILES */ +#else +#if PGP_HAVE64 +typedef PGPInt64 PGPFileOffset; +#else +typedef PGPInt32 PGPFileOffset; +#endif +#endif + +typedef PGPUInt32 PGPFlags; +typedef time_t PGPTime; +typedef PGPULong PGPTimeInterval; /* In milliseconds */ + +#define kPGPMaxTimeInterval (~(PGPTimeInterval)0) + +typedef struct PGPVersion +{ + PGPUInt16 majorVersion; + PGPUInt16 minorVersion; + +} PGPVersion; + +/* character types useful for Unicode issues */ +typedef char PGPChar8; +typedef PGPUInt16 PGPChar16; +typedef PGPUInt32 PGPChar32; +typedef unsigned char PGPUTF8; + +#if PGP_UNICODE +typedef PGPUInt16 PGPChar; +#else +typedef char PGPChar; +#endif + +typedef char PFLChar; +typedef char SDKUIChar; + + +/*____________________________________________________________________________ + These macros should surround all C declarations in public + header files which define function or data symbols. +____________________________________________________________________________*/ + +#ifdef __cplusplus /* [ */ + +#define PGP_BEGIN_C_DECLARATIONS extern "C" { +#define PGP_END_C_DECLARATIONS } + +#else /* ] __cplusplus [ */ + +#define PGP_BEGIN_C_DECLARATIONS +#define PGP_END_C_DECLARATIONS + +#endif /* ] __cplusplus */ + + +#ifndef pgpMin +#define pgpMin(x,y) (((x)<(y)) ? (x) : (y)) +#endif + +#ifndef pgpMax +#define pgpMax(x,y) (((x)>(y)) ? (x) : (y)) +#endif + +#ifndef PGP_DEPRECATED +#define PGP_DEPRECATED 1 +#endif + +#if PGP_WIN32 +# define BIG_ENDIAN 123 +# define LITTLE_ENDIAN 321 +# define BYTE_ORDER LITTLE_ENDIAN +#endif + +#if BYTE_ORDER == BIG_ENDIAN +# define PGP_WORDSBIGENDIAN 1 +# define PGP_WORDSLITTLEENDIAN 0 +#elif BYTE_ORDER == LITTLE_ENDIAN +# define PGP_WORDSBIGENDIAN 0 +# define PGP_WORDSLITTLEENDIAN 1 +#else +# error define your byte order +#endif + +/*____________________________________________________________________________ + * The PGP equivalent of the MS "TEXT" macro. PGPTEXT wraps a string literal + * and causes it to compile as 8 or 16 bit characters on the basis of the + * PGP_UNICODE symbol. + */ +#if PGP_UNICODE + #define PGPTEXT(literal) L##literal +#else + #define PGPTEXT(literal) literal +#endif + +/*____________________________________________________________________________ + * Macros for wrapping text literals. These macros serve two purposes: + * (a) to indicate to the reader of the source code the way in which the + * literal is used (and therefore why the string should not be externalized + * and localized), and (b) to indicate to the compiler whether the literal + * should be compiled as 8-bit or 16-bit characters. + * + * To the right of each macro is the abbreviation to use when naming + * string resources. + */ + +/* PGPTXT_USER should be used for strings which are to be displayed + * to the user, but which we have decided not to translate, for whatever + * reason. + */ +#define PGPTXT_USER(literal) PGPTEXT(literal) /* USR */ +#define PGPTXT_USER8(literal) literal +#define PGPTXT_USER16(literal) L##literal + +/* PGPTXT_ADMIN is for messages to be seen by an admin; we may choose to + * translate these in the future. + */ +#define PGPTXT_ADMIN(literal) PGPTEXT(literal) /* ADM */ + +/* PGPTXT_MACHINE strings are meant to be read by a machine. That is, + * the usual usage would be that this string is never seen by anyone, + * neither users, developers, admins nor qa; it is only seen by programs. + * This includes textual material in tables where that is meant to be + * compared against hardcoded strings looking for a match. Explicit + * 8- and 16-bit versions are provided. + */ +#define PGPTXT_MACHINE(literal) PGPTEXT(literal) /* MAC */ +#define PGPTXT_MACHINE8(literal) literal +#define PGPTXT_MACHINE16(literal) L##literal + +#define PFLTXT_MACHINE PGPTXT_MACHINE8 +#define SDKUITXT_MACHINE PGPTXT_DEBUG8 +#define SDKUITXT_USER PGPTXT_MACHINE8 + +/* String literals in obsolete sections of code may be left in for + * clarity or historical reasons. They should be marked with the + * PGPTXT_OBSOLETE macro. + */ +#define PGPTXT_OBSOLETE(literal) literal /* OBS */ + +/* PGPTXT_FIXBEFORESHIP is for strings for which the tagger is not sure + * what to do with them, but which will need to be decided eventually. + */ +#define PGPTXT_FIXBEFORESHIP(literal) literal /* FIX */ + +/* PGPTXT_DEBUG should be used for strings which are to be seen only by + * developers or testers. This would include compiled-out self-test + * code, debugging code, printf's, messageboxes, debug logs, and asserts. + */ +#define PGPTXT_DEBUG(literal) PGPTEXT(literal) /* DBG */ +#define PGPTXT_DEBUG8(literal) literal +#define PGPTXT_DEBUG16(literal) L##literal + +#define PFLTXT_DEBUG PGPTXT_DEBUG8 +#define SDKUITXT_DEBUG PGPTXT_DEBUG8 + +/* PGPTXT_DEFERRED is used to mark text for which externalization + * has been deferred because the text is not actually used in the + * current implementation but it may be someday. Externalizing + * such text would create unnecessary work for the localizers at + * this point in time. + */ +#define PGPTXT_DEFERRED(literal) PGPTEXT(literal) +#define PGPTXT_DEFERRED8(literal) literal +#define PGPTXT_DEFERRED16(literal) L##literal + +#if defined(__GNUC__) && (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1) && PGP_OSX +#define PGP_WEAK_IMPORT __attribute__((weak_import)) +#else +#define PGP_WEAK_IMPORT +#endif + +#endif /* ] Included_pgpBase_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBigNum.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBigNum.h new file mode 100644 index 0000000000..fdc65e2017 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpBigNum.h @@ -0,0 +1,177 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpBigNum.h,v 1.7 2002/08/06 20:11:16 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpBigNum_h +#define Included_pgpBigNum_h + +#include "pgpBase.h" +#include "pgpUtilities.h" + +PGP_BEGIN_C_DECLARATIONS + +typedef struct PGPBigNum * PGPBigNumRef; +#define kPGPInvalidBigNumRef ( (PGPBigNumRef)NULL ) + +/*____________________________________________________________________________ + Bignum basics +____________________________________________________________________________*/ +PGPError PGPNewBigNum( PGPContextRef context, PGPBoolean secure, + PGPBigNumRef *newBN ); + +PGPError PGPFreeBigNum( PGPBigNumRef bn ); + +PGPError PGPCopyBigNum( PGPBigNumRef src, PGPBigNumRef * dest ); +PGPError PGPAssignBigNum( PGPBigNumRef src, PGPBigNumRef dest ); +PGPError PGPSwapBigNum( PGPBigNumRef a, PGPBigNumRef b); + +/* +** Move bytes between the given buffer and the given BigNum encoded in +** base 256. I.e. after either of these, the buffer will be equal to +** (bn / 256^lsbyte) % 256^len. The difference is which is altered to +** match the other! +*/ +PGPError PGPBigNumExtractBigEndianBytes( PGPBigNumRef bn, + PGPByte *dest, PGPUInt32 lsbyte, PGPUInt32 len ); + +PGPError PGPBigNumInsertBigEndianBytes(PGPBigNumRef bn, + PGPByte const *src, PGPUInt32 lsbyte, PGPUInt32 len ); + +/* The same, but the buffer is little-endian. */ +PGPError PGPBigNumExtractLittleEndianBytes( PGPBigNumRef bn, + PGPByte *dest, PGPUInt32 lsbyte, PGPUInt32 len ); + +PGPError PGPBigNumInsertLittleEndianBytes(PGPBigNumRef bn, + PGPByte const *src, PGPUInt32 lsbyte, PGPUInt32 len ); + +/* Return the least-significant bits (at least 16) of the BigNum */ +PGPUInt16 PGPBigNumGetLSWord( PGPBigNumRef bn ); + +/* + * Return the number of significant bits in the BigNum. + * 0 or 1+floor(log2(src)) + */ +PGPUInt32 PGPBigNumGetSignificantBits( PGPBigNumRef bn ); + +/* + * Adds two bignums into dest. Faster if dest is same as lhs or rhs. + */ +PGPError PGPBigNumAdd( PGPBigNumRef lhs, PGPBigNumRef rhs, + PGPBigNumRef dest ); + +/* + * lhs-rhs. dest and src may be the same, but bnSetQ(dest, 0) is faster. + * if dest < src, returns error and dest is undefined. + */ +PGPError PGPBigNumSubtract( PGPBigNumRef lhs, PGPBigNumRef rhs, + PGPBigNumRef dest, PGPBoolean *underflow ); + +/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmpQ(a, b) <=> 0 */ +PGPInt32 PGPBigNumCompareQ( PGPBigNumRef bn, PGPUInt16 sm ); + +/* dest = src, where 0 <= src < 2^16. */ +PGPError PGPBigNumSetQ( PGPBigNumRef dest, PGPUInt16 sm ); + +/* dest = bn + sm, where 0 <= sm < 2^16 */ +PGPError PGPBigNumAddQ( PGPBigNumRef bn, PGPUInt16 sm, + PGPBigNumRef dest); + +/* dest = bn + sm, where 0 <= sm < 2^16 */ +PGPError PGPBigNumSubtractQ( PGPBigNumRef bn, PGPUInt16 sm, + PGPBigNumRef dest, PGPBoolean *underflow); + +/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmp(a, b) <=> 0 */ +PGPInt32 PGPBigNumCompare( PGPBigNumRef lhs, PGPBigNumRef rhs); + +/* dest = src * src. dest may be the same as src, but it costs time. */ +PGPError PGPBigNumSquare( PGPBigNumRef src, PGPBigNumRef dest); + +/* dest = a * b. dest may be the same as a or b, but it costs time. */ +PGPError PGPBigNumMultiply( PGPBigNumRef lhs, PGPBigNumRef rhs, + PGPBigNumRef dest); + +/* dest = a * b, where 0 <= b < 2^16. dest and a may be the same. */ +PGPError PGPBigNumMultiplyQ( PGPBigNumRef lhs, PGPUInt16 sm, + PGPBigNumRef dest); + +/* + * q = n/d, r = n%d. r may be the same as n, but not d, + * and q may not be the same as n or d. + * re-entrancy issue: this temporarily modifies d, but restores + * it for return. + */ +PGPError PGPBigNumDivide( PGPBigNumRef numerator, PGPBigNumRef denominator, + PGPBigNumRef quotient, PGPBigNumRef remainder); +/* + * dest = n % d. dest and src may be the same, but not dest and d. + * re-entrancy issue: this temporarily modifies d, but restores + * it for return. + */ +PGPError PGPBigNumMod( PGPBigNumRef numerator, PGPBigNumRef denominator, + PGPBigNumRef dest ); + +/* return src % d, where 0 <= d < 2^16. */ +PGPUInt16 PGPBigNumModQ( PGPBigNumRef numerator, PGPUInt16 denominator ); + +/* n = n^exp, modulo "mod" "mod" *must* be odd */ +PGPError PGPBigNumExpMod( PGPBigNumRef n, PGPBigNumRef exponent, + PGPBigNumRef mod, PGPBigNumRef dest ); + +/* + * dest = n1^e1 * n2^e2, modulo "mod". "mod" *must* be odd. + * dest may be the same as n1 or n2. + */ +PGPError PGPBigNumDoubleExpMod( PGPBigNumRef n1, PGPBigNumRef exponent1, + PGPBigNumRef n2, PGPBigNumRef exponent2, + PGPBigNumRef mod, PGPBigNumRef dest ); + +/* dest = 2^exp, modulo "mod" "mod" *must* be odd */ +PGPError PGPBigNumTwoExpMod( PGPBigNumRef exponent, PGPBigNumRef mod, + PGPBigNumRef dest ); + +/* dest = gcd(a, b). The inputs may overlap arbitrarily. */ +PGPError PGPBigNumGCD( PGPBigNumRef a, PGPBigNumRef b, PGPBigNumRef dest ); + +/* dest = src^-1, modulo "mod". dest may be the same as src. */ +PGPError PGPBigNumInv( PGPBigNumRef src, PGPBigNumRef mod, + PGPBigNumRef dest ); + + +/* Shift dest left "amt" places */ +PGPError PGPBigNumLeftShift( PGPBigNumRef dest, PGPUInt32 amt ); + +/* Shift dest right "amt" places, discarding low-order bits */ +PGPError PGPBigNumRightShift( PGPBigNumRef dest, PGPUInt32 amt ); + +/* right shift all low order 0-bits, return number of bits shifted */ +PGPUInt16 PGPBigNumMakeOdd( PGPBigNumRef dest ); + + +PGP_END_C_DECLARATIONS + +#endif /* Included_pgpBigNum_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ + + + + + + + + + + + + diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpCBC.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpCBC.h new file mode 100644 index 0000000000..26ae61d57f --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpCBC.h @@ -0,0 +1,82 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpCBC.h,v 1.6 2002/08/06 20:11:16 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpCBC_h /* [ */ +#define Included_pgpCBC_h + +#include "pgpSymmetricCipher.h" + + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + A CBC context requires use of a symmetric cipher which has been created + and whose key has been set. An error will be returned if this is not + the case. + + After the call, the CBCContextRef "owns" the + symmetric ref and will dispose of it properly (even if an error + occurs). The caller should no longer reference it. +____________________________________________________________________________*/ + +PGPError PGPNewCBCContext( PGPSymmetricCipherContextRef ref, + PGPCBCContextRef *outRef ); + +/*____________________________________________________________________________ + Disposal clears all data in memory before releasing it. +____________________________________________________________________________*/ + +PGPError PGPFreeCBCContext( PGPCBCContextRef ref ); + +/*____________________________________________________________________________ + Make an exact copy, including current state. Original is not changed. +____________________________________________________________________________*/ + +PGPError PGPCopyCBCContext( PGPCBCContextRef ref, PGPCBCContextRef *outRef ); + +/*____________________________________________________________________________ + IV size is implicit (same size as the symmetric cipher block size). + IV is *copied*. + Caller may want to destroy the original after passing it in. +____________________________________________________________________________*/ + +PGPError PGPInitCBC( PGPCBCContextRef ref, const void *key, + const void *initializationVector ); + +/*____________________________________________________________________________ + Call repeatedly to process arbitrary amounts of data. Each call must + have bytesIn be a multiple of the cipher block size. +____________________________________________________________________________*/ + +PGPError PGPCBCEncrypt( PGPCBCContextRef ref, const void *in, + PGPSize bytesIn, void *out ); + +PGPError PGPCBCDecrypt( PGPCBCContextRef ref, const void *in, + PGPSize bytesIn, void *out ); + +/*____________________________________________________________________________ + Get the symmetric cipher being used for this CBC context. + You can use this to determine useful things about the underlying cipher + such as its block size. +____________________________________________________________________________*/ + +PGPError PGPCBCGetSymmetricCipher( PGPCBCContextRef ref, + PGPSymmetricCipherContextRef *outRef ); + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpCBC_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpCFB.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpCFB.h new file mode 100644 index 0000000000..9745f969ec --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpCFB.h @@ -0,0 +1,115 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpCFB.h,v 1.6 2002/08/06 20:11:16 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpCFB_h /* [ */ +#define Included_pgpCFB_h + +#include "pgpSymmetricCipher.h" + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + A CFB context requires use of a symmetric cipher which has been created + and whose key has been set. An error will be returned if this is not + the case. + + After the call, the CFBRef "owns" the symmetric ref and will + dispose of it properly (even if an error occurs). + The caller should no longer reference it. +____________________________________________________________________________*/ + +PGPError PGPNewCFBContext( PGPSymmetricCipherContextRef ref, + PGPUInt16 interleaveFactor, + PGPCFBContextRef *outRef ); + +/*____________________________________________________________________________ + Disposal clears all data in memory before releasing it. +____________________________________________________________________________*/ + +PGPError PGPFreeCFBContext( PGPCFBContextRef ref ); + +/*____________________________________________________________________________ + Make an exact copy, including current state. Original is not changed. +____________________________________________________________________________*/ + +PGPError PGPCopyCFBContext( PGPCFBContextRef ref, + PGPCFBContextRef *outRef ); + +/*____________________________________________________________________________ + IV size is implicit (same size as the symmetric cipher block size). + IV is *copied*. + Caller may want to destroy the original after passing it in. + Calling this implicitly calls PGPResetCFB(). +____________________________________________________________________________*/ + +PGPError PGPInitCFB( PGPCFBContextRef ref, const void *key, + const void *initializationVector ); + +/*____________________________________________________________________________ + Call repeatedly to process arbitrary amounts of data. +____________________________________________________________________________*/ + +PGPError PGPCFBEncrypt( PGPCFBContextRef ref, const void *in, + PGPSize bytesIn, void *out ); + +PGPError PGPCFBDecrypt( PGPCFBContextRef ref, const void *in, + PGPSize bytesIn, void *out ); + +/*____________________________________________________________________________ + Get the symmetric cipher being used for this CFB context. + You can use this to determine useful things about the underlying cipher + such as its block size. +____________________________________________________________________________*/ + +PGPError PGPCFBGetSymmetricCipher(PGPCFBContextRef ref, + PGPSymmetricCipherContextRef *outRef ); + +/*____________________________________________________________________________ + Reset the feedback mechanism to use whatever we have so far, plus previous + bytes for a total of the cipher block size bytes. This effectively + changes the cipher block boundary. +____________________________________________________________________________*/ + +PGPError PGPCFBSync( PGPCFBContextRef ref ); + +/*____________________________________________________________________________ + Fetch random bytes from the cipher. Returns the actual number of + random bytes obtained. +____________________________________________________________________________*/ + +PGPError PGPCFBGetRandom( PGPCFBContextRef ref, PGPSize requestCount, + void *out, PGPSize *outCount); + +/*____________________________________________________________________________ + Make more random bytes available using the supplied salt, which must + be the same as the symmetric cipher block size. +____________________________________________________________________________*/ + +PGPError PGPCFBRandomCycle( PGPCFBContextRef ref, const void *salt); + +/*____________________________________________________________________________ + Make more random bytes available using the supplied salt, which must + be the same as the symmetric cipher block size. +____________________________________________________________________________*/ + +PGPError PGPCFBRandomWash( PGPCFBContextRef ref, const void *in, + PGPSize bytesIn ); + + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpCFB_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpConfig.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpConfig.h new file mode 100644 index 0000000000..f2e9f883a1 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpConfig.h @@ -0,0 +1,96 @@ +/* + * pgpConfig.h -- Configuration for the PGPsdk. This file contains + * the configuration information for the PGPsdk, and it should be + * included in all PGPsdk source files. + * + * $Id: pgpConfig.h,v 1.1.1.1 1999/08/08 19:38:33 heller Exp $ + */ + +/* Define to empty if the compiler does not support 'const' variables. */ +/* #undef const */ + +/* Define to `long' if <sys/types.h> doesn't define. */ +/* #undef off_t */ + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +/* #undef size_t */ + + +#ifndef Included_pgpConfig_h /* [ */ +#define Included_pgpConfig_h + +#include "pgpPFLConfig.h" + + + + + +#ifndef Included_pgpPFLConfig_h /* [ */ + +#define HAVE_STDARG_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_UNISTD_H 0 +#define HAVE_USHORT 0 +#define HAVE_UINT 0 +#define HAVE_ULONG 0 +#define NO_LIMITS_H 0 +#define NO_POPEN 1 + +#if defined( _MSC_VER ) +#define PGP_HAVE64 1 +typedef __int64 PGPInt64; +typedef unsigned __int64 PGPUInt64; + +#elif defined( __MWERKS__ ) + +#define PGP_HAVE64 0 + +#endif + + + +#endif /*Included_pgpPFLConfig_h*/ /* ] */ + + +/* Checks for various types */ +#define HAVE_UCHAR 0 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Checks for various specific header files */ +#define HAVE_FCNTL_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_SYS_IOCTL_H 0 +#define HAVE_SYS_TIME_H 0 +#define HAVE_SYS_TIMEB_H 1 +#define HAVE_SYS_PARAM_H 0 + +/* Check if <sys/time.h> is broken and #includes <time.h> wrong */ +#define TIME_WITH_SYS_TIME 0 + +/* Checks for various functions */ +#define HAVE_GETHRTIME 0 +#define HAVE_CLOCK_GETTIME 0 +#define HAVE_CLOCK_GETRES 0 +#define HAVE_GETTIMEOFDAY 0 +#define HAVE_GETITIMER 0 +#define HAVE_SETITIMER 0 +#define HAVE_FTIME 1 +#define HAVE_MKSTEMP 0 + + +#if defined( __MWERKS__ ) + +#define PGPTTYE /* nothing */ + +#elif defined( _MSC_VER ) + +/* Tags for exported functions, needed for dynamic linking on some platforms */ +#define PGPTTYE /* nothing */ + +#endif + + + +#endif /* ] Included_pgpConfig_h */ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpEC.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpEC.h new file mode 100644 index 0000000000..c12ded4444 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpEC.h @@ -0,0 +1,78 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpEC.h,v 1.12 2003/12/13 01:20:39 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef PGP_EC_PUB_H +#define PGP_EC_PUB_H + +PGP_BEGIN_C_DECLARATIONS + +/* Wrapper for the ec* routines and data types. + These are exported functions from PGPsdk + */ + +typedef signed char ** PGPECContextRef; +typedef signed short ** PGPECPointRef; +typedef signed int ** PGPECScalarRef; + +enum PGPECMemoryUsage_ +{ + kPGPECMemoryMedium = 0, + kPGPECMemoryHigh = 1, + + PGP_ENUM_FORCE( PGPECMemoryUsage_ ) +}; +PGPENUM_TYPEDEF( PGPECMemoryUsage_, PGPECMemoryUsage ); + +PGPError PGPECCreate2mContext( PGPMemoryMgrRef memoryMgr, + PGPSize bitsize, PGPECMemoryUsage memUsage, + PGPECContextRef *c ); + +PGPError PGPECFreeContext( PGPECContextRef p ); + +PGPError PGPECSetEC2mParamA( PGPECContextRef c, const unsigned *a ); +PGPError PGPECSetEC2mParamB( PGPECContextRef c, const unsigned *b ); +PGPError PGPECSetEC2mParamAInt( PGPECContextRef c, unsigned a ); +PGPError PGPECSetEC2mParamBInt( PGPECContextRef c, unsigned b ); + +PGPError PGPECGetBufferSize( PGPECContextRef c, + PGPSize *coordinateSize, PGPSize *scalarSize, + PGPSize *pointDecomprSize, PGPSize *pointComprSize ); + +PGPError PGPECScalarCreate( PGPECContextRef c, PGPECScalarRef *s, PGPBoolean isSecure ); +PGPError PGPECScalarFree( PGPECScalarRef s ); +PGPError PGPECScalarInsertBytes( PGPECScalarRef s, + const PGPByte *scalar /*network order*/, PGPECScalarRef G_ord ); + +PGPError PGPECPointCreate( PGPECContextRef c, PGPECPointRef *p ); +PGPError PGPECPointFree( PGPECPointRef p ); + +PGPError PGPECPointExtractBytes( PGPECPointRef p, PGPByte *out, unsigned flags ); +PGPError PGPECPointExtractXYBytes( PGPECPointRef p, PGPByte *out_x, PGPByte *out_y, unsigned flags ); +PGPError PGPECPointInsertBytes( PGPECPointRef p, const PGPByte *in, unsigned flags ); + +PGPError PGPECPointAssignContext( PGPECPointRef p, PGPECContextRef c ); + +PGPError PGPECPointPrefBasis( PGPECPointRef p ); + +PGPError PGPECPointMul( PGPECPointRef p, + PGPECScalarRef scalar, + PGPBoolean isPrecomputed, /* PGPECPointPrecomp already called */ + PGPECPointRef out ); + +PGPError PGPECPointAdd( PGPECPointRef p0, const PGPECPointRef p1, PGPECPointRef sum ); + +PGPError PGPECPointSetZero( PGPECPointRef p ); +PGPBoolean PGPECPointIsZero( PGPECPointRef p ); + +PGPBoolean PGPECPointIsConsistent( PGPECPointRef p ); + +PGPError PGPECPointCompress( PGPECPointRef p ); +PGPError PGPECPointDecompress( PGPECPointRef p ); + +PGP_END_C_DECLARATIONS + +#endif /* PGP_EC_PUB_H */ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpEncode.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpEncode.h new file mode 100644 index 0000000000..9f2830ddf0 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpEncode.h @@ -0,0 +1,306 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + This file contains the prototypes for functions which encode/decode files + and buffers. + + $Id: pgpEncode.h,v 1.20 2003/09/24 03:09:32 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpEncode_h /* [ */ +#define Included_pgpEncode_h + +#include "pgpPubTypes.h" +#include "pgpTLS.h" + +#if PGP_MACINTOSH +#pragma options align=mac68k +#endif + +/*____________________________________________________________________________ + PGP Events + + The PGPEvent structure is used to notify clients of the encode API of + various events. Each event is denoted by an event type: +____________________________________________________________________________*/ + +enum PGPEventType_ +{ + kPGPEvent_NullEvent = 0, /* Nothing happened */ + kPGPEvent_InitialEvent = 1, /* Final event */ + kPGPEvent_FinalEvent = 2, /* Final event */ + kPGPEvent_ErrorEvent = 3, /* An error occurred */ + kPGPEvent_WarningEvent = 4, /* Warning event */ + kPGPEvent_EntropyEvent = 5, /* More entropy is needed */ + kPGPEvent_PassphraseEvent = 6, /* A passphrase is needed */ + kPGPEvent_InsertKeyEvent = 7, /* Smart card must be inserted */ + kPGPEvent_AnalyzeEvent = 8, /* Initial analysis event, + before any output */ + kPGPEvent_RecipientsEvent = 9, /* Recipient list report, + before any output */ + kPGPEvent_KeyFoundEvent = 10, /* Key packet found */ + kPGPEvent_OutputEvent = 11, /* Output specification needed */ + kPGPEvent_SignatureEvent = 12, /* Signature status report */ + kPGPEvent_BeginLexEvent = 13, /* Initial event per lexical unit*/ + kPGPEvent_EndLexEvent = 14, /* Final event per lexical unit */ + kPGPEvent_RecursionEvent = 15, /* Notification of recursive + job creation */ + kPGPEvent_DetachedSignatureEvent = 16, /* Need input for verification of + detached signature */ + kPGPEvent_KeyGenEvent = 17, /* Key generation progress */ + + kPGPEvent_KeyServerEvent = 18, /* Key Server progress */ + kPGPEvent_KeyServerSignEvent= 19, /* Key Server passphrase */ + kPGPEvent_KeyServerTLSEvent = 20, /* Key Server TLS event */ + kPGPEvent_KeyServerIdleEvent= 21, /* Idle during keyserver call */ + + kPGPEvent_SocketsIdleEvent = 22, /* Idle during sockets */ + kPGPEvent_DecryptionEvent = 23, /* Decryption data report */ + kPGPEvent_EncryptionEvent = 24, /* Encryption data report */ + + kPGPEvent_ToBeSignedEvent = 25, /* To-be-signed hash */ + + PGP_ENUM_FORCE( PGPEventType_ ) +}; +PGPENUM_TYPEDEF( PGPEventType_, PGPEventType ); + + +/* PGP Analyze event callback codes */ + +enum PGPAnalyzeType_ +{ + kPGPAnalyze_Encrypted = 0, /* Encrypted message */ + kPGPAnalyze_Signed = 1, /* Signed message */ + kPGPAnalyze_DetachedSignature = 2, /* Detached signature */ + kPGPAnalyze_Key = 3, /* Key data */ + kPGPAnalyze_Unknown = 4, /* Non-pgp message */ + kPGPAnalyze_X509Certificate = 5, /* X.509 certificate */ + kPGPAnalyze_SMIMEBody = 6, /* SMIME body */ + + PGP_ENUM_FORCE( PGPAnalyzeType_ ) +}; +PGPENUM_TYPEDEF( PGPAnalyzeType_, PGPAnalyzeType ); + +/* Individual event information structs, combined as a union in PGPEvent */ + +typedef struct PGPEventNullData_ +{ + PGPFileOffset bytesWritten; + PGPFileOffset bytesTotal; +} PGPEventNullData; + +typedef struct PGPEventErrorData_ +{ + PGPError error; + void *errorArg; +} PGPEventErrorData; + +typedef struct PGPEventWarningData_ +{ + PGPError warning; + void *warningArg; +} PGPEventWarningData; + +typedef struct PGPEventEntropyData_ +{ + PGPUInt32 entropyBitsNeeded; +} PGPEventEntropyData; + +typedef struct PGPEventPassphraseData_ +{ + PGPBoolean fConventional; + PGPKeySetRef keyset; + const PGPByte *ESKs; + PGPSize ESKsLength; +} PGPEventPassphraseData; + +typedef struct PGPEventRecipientsData_ +{ + PGPKeySetRef recipientSet; + PGPUInt32 conventionalPassphraseCount; + PGPUInt32 keyCount; + PGPKeyID const * keyIDArray; +} PGPEventRecipientsData; + +typedef struct PGPEventKeyFoundData_ +{ + PGPKeyDBRef keyDB; +} PGPEventKeyFoundData; + +typedef struct PGPEventSignatureData_ +{ + PGPKeyID signingKeyID; + PGPKeyDBObjRef signingKey; + PGPBoolean checked; + PGPBoolean verified; + PGPBoolean keyRevoked; + PGPBoolean keyDisabled; + PGPBoolean keyExpired; + PGPBoolean keyMeetsValidityThreshold; + PGPValidity keyValidity; + PGPTime creationTime; + PGPUInt32 expirationPeriod; +} PGPEventSignatureData; + +typedef struct PGPEventDecryptionData_ +{ + PGPCipherAlgorithm cipherAlgorithm; + PGPByte *sessionKey; + PGPSize sessionKeyLength; + PGPUInt32 keyCount; /* keyids of keys that can decrypt, */ + PGPKeyID const * keyIDArray; /* a subset of keys in PGPEventRecipientsData */ +} PGPEventDecryptionData; + +typedef struct PGPEventEncryptionData_ +{ + PGPCipherAlgorithm cipherAlgorithm; + PGPByte *sessionKey; + PGPSize sessionKeyLength; +} PGPEventEncryptionData; + +typedef struct PGPEventAnalyzeData_ +{ + PGPAnalyzeType sectionType; +} PGPEventAnalyzeData; + +typedef struct PGPEventOutputData_ +{ + PGPUInt32 messageType; + PGPChar8 *suggestedName; + PGPBoolean forYourEyesOnly; +} PGPEventOutputData; + +typedef struct PGPEventBeginLexData_ +{ + PGPUInt32 sectionNumber; + PGPSize sectionOffset; +} PGPEventBeginLexData; + +typedef struct PGPEventEndLexData_ +{ + PGPUInt32 sectionNumber; +} PGPEventEndLexData; + +typedef struct PGPEventKeyGenData_ +{ + PGPUInt32 state; +} PGPEventKeyGenData; + +typedef struct PGPEventKeyServerData_ +{ + PGPKeyServerRef keyServerRef; + PGPUInt32 state; /* PGPKeyServerState */ +} PGPEventKeyServerData; + +typedef struct PGPEventKeyServerSignData_ +{ + PGPKeyServerRef keyServerRef; +} PGPEventKeyServerSignData; + +typedef struct PGPEventKeyServerTLSData_ +{ + PGPKeyServerRef keyServerRef; + PGPUInt32 state; /* PGPKeyServerState */ + PGPtlsSessionRef tlsSession; +} PGPEventKeyServerTLSData; + +typedef struct PGPEventKeyServerIdleData_ +{ + PGPKeyServerRef keyServerRef; +} PGPEventKeyServerIdleData; + +typedef struct PGPEventToBeSignedData_ +{ + PGPKeyID keyID; + PGPHashAlgorithm hashAlg; + PGPByte hash[512/8]; + PGPSize hashSize; +} PGPEventToBeSignedData; + +/* + * The following events have no event-specific data defined for them: + * kPGPEvent_InsertKeyEvent + * kPGPEvent_RecursionEvent + * kPGPEvent_DetachedSignatureEvent + * kPGPEvent_InitialEvent + * kPGPEvent_FinalEvent + * kPGPEvent_SocketsIdleEvent + */ + +/* Union of all event data structures above */ +typedef union PGPEventData_ +{ + PGPEventNullData nullData; + PGPEventErrorData errorData; + PGPEventWarningData warningData; + PGPEventEntropyData entropyData; + PGPEventPassphraseData passphraseData; + PGPEventRecipientsData recipientsData; + PGPEventKeyFoundData keyFoundData; + PGPEventSignatureData signatureData; + PGPEventDecryptionData decryptionData; + PGPEventEncryptionData encryptionData; + PGPEventAnalyzeData analyzeData; + PGPEventOutputData outputData; + PGPEventBeginLexData beginLexData; + PGPEventEndLexData endLexData; + PGPEventKeyGenData keyGenData; + PGPEventKeyServerData keyServerData; + PGPEventKeyServerSignData keyServerSignData; + PGPEventKeyServerTLSData keyServerTLSData; + PGPEventKeyServerIdleData keyServerIdleData; + PGPEventToBeSignedData tbsData; +} PGPEventData; + +/* Refs to internal "job" structure */ +typedef struct PGPJob * PGPJobRef; + +#define kInvalidPGPJobRef ((PGPJobRef) NULL) +#define PGPJobRefIsValid( ref ) ( (ref) != kInvalidPGPJobRef ) + +/* PGPEvent structure */ + +struct PGPEvent +{ + PGPVersion version; /* Version of event structure */ + struct PGPEvent_ *nextEvent; /* Allow lists of events */ + PGPJobRef job; /* Associated with what job */ + PGPEventType type; /* Type of event */ + PGPEventData data; /* Event specific data */ +}; +typedef struct PGPEvent PGPEvent; + + +#if PGP_MACINTOSH +#pragma options align=reset +#endif + +PGP_BEGIN_C_DECLARATIONS + +/* +** Functions to encode and decode. The variable parameters are one or more +** PGPOptionListRef's which describe the inputs, outputs, and options. +*/ + +PGPError PGPEncode(PGPContextRef context, + PGPOptionListRef firstOption, ...); +PGPError PGPDecode(PGPContextRef context, + PGPOptionListRef firstOption, ...); + +PGPError PGPAddJobOptions(PGPJobRef job, + PGPOptionListRef firstOption, ...); + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpEncode_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpErrors.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpErrors.h new file mode 100644 index 0000000000..7174b0a9e6 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpErrors.h @@ -0,0 +1,393 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + Error codes for all PGPsdk errors can be found in this file. + + $Id: pgpErrors.h,v 1.28 2004/04/26 21:23:53 vinnie Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpErrors_h /* [ */ +#define Included_pgpErrors_h + +#include "pgpPubTypes.h" + + +#include "pgpPFLErrors.h" + +#define kPGPErrorRange 1000 + +enum PGPError_ +{ + /* + NOTE: error code values must not be changed; + compiled client code depends on them. + */ + kPGPError_FirstError = -11500, + kPGPError_Last = -10500, + + kPGPError_BadPassphrase = -11500, + kPGPError_OptionNotFound = -11499, + +/* Errors from pgpEncode */ + kPGPError_RedundantOptions = -11498, + kPGPError_KeyRevoked = -11497, + kPGPError_KeyExpired = -11496, + kPGPError_KeyDisabled = -11495, + kPGPError_KeyInvalid = -11494, + kPGPError_KeyUnusableForEncryption = -11493, + kPGPError_KeyUnusableForSignature = -11492, + kPGPError_OutputBufferTooSmall = -11491, + kPGPError_InconsistentEncryptionAlgorithms = -11490, + kPGPError_MissingPassphrase = -11489, + kPGPError_CombinedConventionalAndPublicEncryption= -11488, + kPGPError_DetachedSignatureWithoutSigningKey= -11487, + kPGPError_DetachedSignatureWithEncryption = -11486, + kPGPError_NoInputOptions = -11485, + kPGPError_MultipleInputOptions = -11484, + kPGPError_InputFile = -11483, + kPGPError_NoOutputOptions = -11482, + kPGPError_MultipleOutputOptions = -11481, + kPGPError_MissingEventHandler = -11480, + kPGPError_MissingKeyDB = -11479, + kPGPError_DetachedSignatureFound = -11478, + kPGPError_NoDecryptionKeyFound = -11477, + kPGPError_CorruptSessionKey = -11476, + kPGPError_SkipSection = -11475, + kPGPError_Interrupted = -11474, + kPGPError_TooManyARRKs = -11473, + kPGPError_KeyUnusableForDecryption = -11472, + kPGPError_KeygenTimedOut = -11471, + + kPGPError_IncompatibleAPI = -11460, + +/* misc errors */ + kPGPError_CompressionFailed = -11453, + kPGPError_UnTARFailed = -11452, + kPGPError_MinorUnTARError = -11451, + kPGPError_NotMacBinary = -11450, + kPGPError_NoMacBinaryTranslationAvailable = -11449, + kPGPError_BadSignature = -11448, + kPGPError_CAPIUnsupportedKey = -11447, + kPGPError_SelfTestFailed = -11446, + kPGPError_SelfTestsNotExecuted = -11445, + kPGPError_BadIntegrity = -11444, + kPGPError_DeCompressionFailed = -11443, + kPGPError_DeletingSelfSig = -11442, + +/* filter errors */ + + kPGPError_InconsistentFilterClasses = -11440, + kPGPError_UnsupportedLDAPFilter = -11439, + kPGPError_UnsupportedHKPFilter = -11438, + kPGPError_UnknownFilterType = -11437, + kPGPError_InvalidFilterParameter = -11436, + kPGPError_UnsupportedNetToolsCAFilter = -11435, + +/* old errors: */ + + kPGPError_OutOfRings = -11420, + kPGPError_BadHashNumber = -11419, + kPGPError_BadCipherNumber = -11418, + kPGPError_BadKeyLength = -11417, + kPGPError_SizeAdviseFailure = -11416, + kPGPError_ConfigParseFailure = -11415, + kPGPError_ConfigParseFailureBadFunction = -11414, + kPGPError_ConfigParseFailureBadOptions = -11413, + kPGPError_KeyIsLocked = -11412, + kPGPError_CantDecrypt = -11411, + kPGPError_UnknownString2Key = -11410, + kPGPError_BadSessionKeySize = -11409, + kPGPError_UnknownVersion = -11408, + kPGPError_BadSessionKeyAlgorithm = -11407, + kPGPError_UnknownSignatureType = -11406, + kPGPError_BadSignatureSize = -11405, + kPGPError_SignatureBitsWrong = -11404, + kPGPError_ExtraDateOnSignature = -11403, + kPGPError_SecretKeyNotFound = -11402, + kPGPError_AdditionalRecipientRequestKeyNotFound = -11401, + kPGPError_InvalidCommit = -11400, + kPGPError_CantHash = -11399, + kPGPError_UnbalancedScope = -11398, + kPGPError_WrongScope = -11397, + kPGPError_FIFOReadError = -11396, + kPGPError_RandomSeedTooSmall = -11395, + kPGPError_EnvPriorityTooLow = -11394, + kPGPError_UnknownCharMap = -11393, + kPGPError_AsciiParseIncomplete = -11392, + kPGPError_BadPacket = -11391, + + kPGPError_TroubleKeySubKey = -11390, + kPGPError_TroubleSigSubKey = -11389, + kPGPError_TroubleBadTrust = -11388, + kPGPError_TroubleUnknownPacketByte = -11387, + kPGPError_TroubleUnexpectedSubKey = -11386, + kPGPError_TroubleUnexpectedName = -11385, + kPGPError_TroubleUnexpectedSignature = -11384, + kPGPError_TroubleUnexpectedUnknown = -11383, + kPGPError_TroubleUnexpectedTrust = -11382, + kPGPError_TroubleKeyTooBig = -11381, + kPGPError_TroubleSecretKeyTooBig = -11380, + kPGPError_TroubleNameTooBig = -11379, + kPGPError_TroubleSignatureTooBig = -11378, + kPGPError_TroubleUnknownTooBig = -11377, + kPGPError_TroubleDuplicateKeyID = -11376, + kPGPError_TroubleDuplicateKey = -11375, + kPGPError_TroubleDuplicateSecretKey = -11374, + kPGPError_TroubleDuplicateName = -11373, + kPGPError_TroubleDuplicateSignature = -11372, + kPGPError_TroubleDuplicateUnknown = -11371, + kPGPError_TroubleBareKey = -11370, + kPGPError_TroubleVersionBugPrev = -11369, + kPGPError_TroubleVersionBugCur = -11368, + kPGPError_TroubleOldSecretKey = -11367, + kPGPError_TroubleNewSecretKey = -11366, + kPGPError_TroubleImportingNonexportableSignature= -11365, + kPGPError_TroubleDuplicateCRL = -11364, + kPGPError_TroubleCRLTooBig = -11363, + + kPGPError_BadCompressionNumber = -11362, + + /* + * The set of errors in this range are the ones which will NOT abort + * a keyring check operation. These errors just make us skip the key + * and go on to the next. + */ +kPGPError_KEY_MIN = -11350, + kPGPError_KEY_LONG = kPGPError_KEY_MIN, + kPGPError_KeyPacketTruncated = -11349, + kPGPError_UnknownKeyVersion = -11348, + kPGPError_UnknownPublicKeyAlgorithm = -11347, + kPGPError_MalformedKeyModulus = -11346, + kPGPError_MalformedKeyExponent = -11345, + kPGPError_RSAPublicModulusIsEven = -11344, + kPGPError_RSAPublicExponentIsEven = -11343, + kPGPError_MalformedKeyComponent = -11342, + kPGPError_KeyTooLarge = -11341, + kPGPError_PublicKeyTooSmall = -11340, + kPGPError_PublicKeyTooLarge = -11339, + kPGPError_PublicKeyUnimplemented = -11338, + kPGPError_CRLPacketTruncated = -11337, + kPGPError_CorruptPrivateKey = -11336, + kPGPError_UnknownPaddingType = -11335, +kPGPError_KEY_MAX = kPGPError_CorruptPrivateKey, + + +/* kPGPError_SIG_MAX */ + kPGPError_SIG_LONG = -11330, + kPGPError_TruncatedSignature = -11329, + kPGPError_MalformedSignatureInteger = -11328, + kPGPError_UnknownSignatureAlgorithm = -11327, + kPGPError_ExtraSignatureMaterial = -11326, + kPGPError_UnknownSignatureVersion = -11325, + kPGPError_RevocationKeyNotFound = -11324, +/* kPGPError_SIG_MIN */ + +/* kPGPError_KEYDB_MAX */ + kPGPError_OutOfEntropy = -11320, + kPGPError_ItemIsReadOnly = -11319, + kPGPError_InvalidProperty = -11318, + kPGPError_FileCorrupt = -11317, + kPGPError_DuplicateCert = -11316, + kPGPError_DuplicateUserID = -11315, + kPGPError_CertifyingKeyDead = -11314, + kPGPError_ItemWasDeleted = -11313, + kPGPError_KeyDBMismatch = -11312, +/* kPGPError_KEYDB_MIN = kPGPError_KeyDBMismatch */ + +/* kPGPError_SERVER_MAX */ + kPGPError_ServerInProgress = -11300, + kPGPError_ServerOperationNotSupported = -11299, + kPGPError_ServerInvalidProtocol = -11298, + kPGPError_ServerRequestFailed = -11297, + kPGPError_ServerOpen = -11296, + kPGPError_ServerNotOpen = -11295, + kPGPError_ServerKeyAlreadyExists = -11294, + kPGPError_ServerNotInitialized = -11293, + kPGPError_ServerPartialAddFailure = -11292, + kPGPError_ServerCorruptKeyBlock = -11291, + kPGPError_ServerUnknownResponse = -11290, + kPGPError_ServerTimedOut = -11289, + kPGPError_ServerOpenFailed = -11288, + kPGPError_ServerAuthorizationRequired = -11287, + kPGPError_ServerAuthorizationFailed = -11286, + kPGPError_ServerSearchFailed = -11285, + kPGPError_ServerPartialSearchResults = -11284, + kPGPError_ServerBadKeysInSearchResults = -11283, + kPGPError_ServerKeyFailedPolicy = -11282, + kPGPError_ServerOperationRequiresTLS = -11281, + kPGPError_ServerNoStaticStorage = -11280, + kPGPError_ServerCertNotFound = -11279, + +/* TLS errors */ + kPGPError_TLSUnexpectedClose = -11250, + kPGPError_TLSProtocolViolation = -11249, + kPGPError_TLSVersionUnsupported = -11248, + kPGPError_TLSWrongState = -11247, + kPGPError_TLSAlertReceived = -11246, + kPGPError_TLSKeyUnusable = -11245, + kPGPError_TLSNoCommonCipher = -11244, + kPGPError_TLSWouldBlock = -11243, + kPGPError_TLSRcvdHandshakeRequest = -11242, + +/* X509 certificate errors */ + kPGPError_X509NeededCertNotAvailable = -11240, + kPGPError_X509SelfSignedCert = -11239, + kPGPError_X509InvalidCertificateSignature = -11238, + kPGPError_X509InvalidCertificateFormat = -11237, + kPGPError_X509InvalidCertificateTree = -11236, + +/* Key Splitting errors */ + kPGPError_SplitNotEnoughSharesInObject = -11230, + kPGPError_SplitDifferentSplitKeys = -11229, + kPGPError_SplitDifferentSharePool = -11228, + kPGPError_SplitIdenticalShares = -11227, + kPGPError_SKEPRejectedAuthentication = -11226, + kPGPError_SKEPIncorrectVersion = -11225, + +/* SECSH errors */ + kPGPError_SECSHUnexpectedClose = -11220, + kPGPError_SECSHProtocolViolation = -11219, + kPGPError_SECSHVersionUnsupported = -11218, + kPGPError_SECSHWrongState = -11217, + kPGPError_SECSHAlertReceived = -11216, + kPGPError_SECSHKeyUnusable = -11215, + kPGPError_SECSHNoCommonCipher = -11214, + kPGPError_SECSHWouldBlock = -11213, + kPGPError_SECSHRcvdHandshakeRequest = -11212, + + kPGPError_BigNumNoInverse = -11150, + +/* PGPSockets errors */ + kPGPError_SocketsNetworkDown = -11100, + kPGPError_SocketsNotInitialized = -11099, + kPGPError_SocketsInProgress = -11098, + kPGPError_SocketsNotConnected = -11097, + kPGPError_SocketsNotBound = -11096, + kPGPError_SocketsOperationNotSupported = -11095, + kPGPError_SocketsProtocolNotSupported = -11094, + kPGPError_SocketsAddressFamilyNotSupported = -11093, + kPGPError_SocketsNotASocket = -11092, + kPGPError_SocketsAddressInUse = -11091, + kPGPError_SocketsBufferOverflow = -11090, + kPGPError_SocketsListenQueueFull = -11089, + kPGPError_SocketsAddressNotAvailable = -11088, + kPGPError_SocketsAlreadyConnected = -11087, + kPGPError_SocketsTimedOut = -11086, + kPGPError_SocketsNoStaticStorage = -11085, + + kPGPError_SocketsHostNotFound = -11050, + kPGPError_SocketsDomainServerError = -11049, + +/* Errors from X.509 layer */ + kPGPError_X509AttributeNotSupported = -10999, + kPGPError_InvalidPKCS7Encoding = -10998, + kPGPError_CMSInitialization = -10997, + kPGPError_InvalidDistinguishedName = -10996, + kPGPError_CertRequestCreationFailure = -10995, + kPGPError_MissingX509Certificate = -10994, + kPGPError_PKCS7SignFailure = -10993, + kPGPError_ASNPackFailure = -10992, + kPGPError_InvalidInputFormat = -10991, + kPGPError_InvalidOutputFormat = -10990, + kPGPError_InvalidCertificateExtension = -10989, + kPGPError_PublicKeyNotFound = -10988, + + kPGPError_CRSMissingRequiredAttribute = -10979, + kPGPError_CRSInvalidCharacter = -10978, + kPGPError_CRSInvalidAttributeType = -10977, + kPGPError_CRSInvalidCertType = -10976, + kPGPError_CRSInvalidAttributeValueLength = -10975, + kPGPError_CRSInvalidAuthenticateValue = -10974, + + kPGPError_X509CertificateParseError = -10973, + kPGPError_PKCS7EncryptFailure = -10972, + kPGPError_PKCS7DecryptFailure = -10971, + + kPGPError_InvalidCertificateFormat = -11970, + +/* LDAP Errors */ +kPGPError_LDAPMIN = -10950, + kPGPError_LDAPOperationsError = kPGPError_LDAPMIN, + kPGPError_LDAPProtocolError = -10949, + kPGPError_LDAPTimelimitExceeded = -10948, + kPGPError_LDAPSizelimitExceeded = -10947, + kPGPError_LDAPStrongAuthNotSupported = -10946, + kPGPError_LDAPStrongAuthRequired = -10945, + kPGPError_LDAPPartialResults = -10944, + kPGPError_LDAPNoSuchAttribute = -10943, + kPGPError_LDAPUndefinedType = -10942, + kPGPError_LDAPInappropriateMatching = -10941, + kPGPError_LDAPConstraintViolation = -10940, + kPGPError_LDAPTypeOrValueExists = -10939, + kPGPError_LDAPInvalidSyntax = -10938, + kPGPError_LDAPNoSuchObject = -10937, + kPGPError_LDAPAliasProblem = -10936, + kPGPError_LDAPInvalidDNSyntax = -10935, + kPGPError_LDAPIsLeaf = -10934, + kPGPError_LDAPAliasDerefProblem = -10933, + kPGPError_LDAPInappropriateAuth = -10932, + kPGPError_LDAPInvalidCredentials = -10931, + kPGPError_LDAPInsufficientAccess = -10930, + kPGPError_LDAPBusy = -10929, + kPGPError_LDAPUnavailable = -10928, + kPGPError_LDAPUnwillingToPerform = -10927, + kPGPError_LDAPLoopDetect = -10926, + kPGPError_LDAPNamingViolation = -10925, + kPGPError_LDAPObjectClassViolation = -10924, + kPGPError_LDAPNotAllowedOnNonleaf = -10923, + kPGPError_LDAPNotAllowedOnRDN = -10922, + kPGPError_LDAPAlreadyExists = -10921, + kPGPError_LDAPNoObjectClassMods = -10920, + kPGPError_LDAPResultsTooLarge = -10919, + kPGPError_LDAPOther = -10918, + kPGPError_LDAPServerDown = -10917, + kPGPError_LDAPLocalError = -10916, + kPGPError_LDAPEncodingError = -10915, + kPGPError_LDAPDecodingError = -10914, + kPGPError_LDAPTimeout = -10913, + kPGPError_LDAPAuthUnknown = -10912, + kPGPError_LDAPFilterError = -10911, + kPGPError_LDAPUserCancelled = -10910, + kPGPError_LDAPParamError = -10909, + kPGPError_LDAPConnectError = -10908, + /* Reserve errors -10907 through -10881 for future LDAP versions */ + kPGPError_LDAPNotLDAPURL = -10880, + kPGPError_LDAPNoDN = -10879, + kPGPError_LDAPBadScope = -10878, +kPGPError_LDAPMAX = kPGPError_LDAPBadScope, + + /* Smart Card Errors */ + kPGPError_SmartCardError = -10850, + kPGPError_SmartCardOutOfMemory = -10849, + kPGPError_SmartCardKeyNotFound = -10848, + kPGPError_SmartCardX509Exists = -10847, + kPGPError_SmartCardKeyExists = -10846, + kPGPError_SmartCardPinLocked = -10845, + kPGPError_SmartCardNotFound = -10844, + + kPGPError_DummyEnumValue + /* kPGPError_Last */ +} ; + + +PGP_BEGIN_C_DECLARATIONS + +#undef PGPGetErrorString +PGPError PGPGetErrorString( PGPError theError, + PGPSize bufferSize, PGPChar8 * theString ); + +PGP_END_C_DECLARATIONS + + +#endif /* ] Included_pgpErrors_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpFeatures.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpFeatures.h new file mode 100644 index 0000000000..ad628a283b --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpFeatures.h @@ -0,0 +1,143 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + Determine which features are present in the PGPsdk. This is the only + way to correctly determine which features are present. The version + number may be the same for different builds that lack some features. + + $Id: pgpFeatures.h,v 1.13 2004/03/15 19:18:55 vinnie Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpFeatures_h /* [ */ +#define Included_pgpFeatures_h + +#include "pgpPubTypes.h" + +#if PGP_MACINTOSH +#pragma options align=mac68k /* [ */ +#endif + +/*____________________________________________________________________________ + Each selector designates a PGPFlags word, which can be obtained via + PGPGetFeatureFlags(). The flags can be tested using the + supplied masks. We can add more selectors as needed. The masks + are not intended to be restricted to a single bit. + Flags should not be used for attributes that have unknown length. + + A kPGPError_ItemNotFound will be returned if the caller specifies + a selector which is not recognized by the PGPsdk. This could + occur if an app links to an older version of the SDK. +____________________________________________________________________________*/ + +/* selectors which are passed to PGPGetFeatureFlags */ +enum PGPFeatureSelector_ +{ + kPGPFeatures_GeneralSelector = 1, + kPGPFeatures_ImplementationSelector = 2, + + PGP_ENUM_FORCE( PGPFeatureSelector_ ) +}; +PGPENUM_TYPEDEF( PGPFeatureSelector_, PGPFeatureSelector ); + + +/* flags for kPGPFeatures_GeneralSelector */ +enum +{ + kPGPFeatureMask_CanEncrypt = (1UL << 0), + kPGPFeatureMask_CanDecrypt = (1UL << 1), + kPGPFeatureMask_CanSign = (1UL << 2), + kPGPFeatureMask_CanVerify = (1UL << 3), + kPGPFeatureMask_CanGenerateKey = (1UL << 4), + kPGPFeatureMask_RngHardware = (1UL << 5), + kPGPFeatureMask_FIPSmode = (1UL << 6) +}; + +/* flags for kPGPFeatures_ImplementationSelector */ +enum +{ + kPGPFeatureMask_IsDebugBuild = (1UL << 0), + kPGPFeatureMask_HasTimeout = (1UL << 0) +}; + +#define kPGPAlgorithmInfoFlags_FIPS (PGPFlags)(1UL << 1 ) + +typedef struct PGPAlgorithmInfo +{ + PGPChar8 shortName[ 32 ]; + PGPChar8 longName[ 96 ]; + PGPChar8 copyright[ 128 ]; + PGPFlags flags; + PGPUInt32 reserved[ 16 ]; /* reserved; 0 for now */ + +} PGPAlgorithmInfo; + +typedef struct PGPPublicKeyAlgorithmInfo +{ + PGPAlgorithmInfo info; + + PGPPublicKeyAlgorithm algID; + + PGPBoolean canEncrypt; + PGPBoolean canDecrypt; + PGPBoolean canSign; + PGPBoolean canVerify; + PGPBoolean canGenerateKey; + PGPBoolean reserved1; + PGPBoolean reserved2; + PGPBoolean reserved3; + + PGPUInt32 reserved[ 8 ]; + +} PGPPublicKeyAlgorithmInfo; + +typedef struct PGPSymmetricCipherInfo +{ + PGPAlgorithmInfo info; + PGPCipherAlgorithm algID; + + PGPUInt32 reserved[ 8 ]; + +} PGPSymmetricCipherInfo; + +#if PGP_MACINTOSH +#pragma options align=reset /* ] */ +#endif + +PGP_BEGIN_C_DECLARATIONS + +/* return a flags word for the feature selector */ +PGPError PGPGetFeatureFlags( PGPFeatureSelector selector, + PGPFlags *flags ); + +/* use this to test whether a feature exists after getting flags */ +#define PGPFeatureExists( flags, maskValue ) ( ( (flags) & (maskValue) ) != 0 ) + + +/*____________________________________________________________________________ + Routines to determine which algorithms are present. + + To determine if a specific algorithm is available, you will need to + index through the available algorithms and check the algorithm ID. +____________________________________________________________________________*/ + +PGPError PGPCountPublicKeyAlgorithms( PGPUInt32 *numPKAlgs ); +PGPError PGPGetIndexedPublicKeyAlgorithmInfo( PGPUInt32 theIndex, + PGPPublicKeyAlgorithmInfo *info); + +PGPError PGPCountSymmetricCiphers( PGPUInt32 *numPKAlgs ); +PGPError PGPGetIndexedSymmetricCipherInfo( PGPUInt32 theIndex, + PGPSymmetricCipherInfo *info); + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpFeatures_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpGroups.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpGroups.h new file mode 100644 index 0000000000..2f6ebd07af --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpGroups.h @@ -0,0 +1,315 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpGroups.h,v 1.12 2003/08/08 04:40:39 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpGroups_h /* [ */ +#define Included_pgpGroups_h + +/*____________________________________________________________________________ + Note: All functions in this file have been deprecated and will be + replaced in the future with equivalent functionality. +____________________________________________________________________________*/ + +#include "pgpPubTypes.h" +#include "pgpEncode.h" + +#if PGP_DEPRECATED /* [ */ + +#if PGP_MACINTOSH +#include <Files.h> +#endif + +#if PGP_MACINTOSH +#pragma options align=mac68k +#endif + +#define kPGPMaxGroupNameLength 63 +#define kPGPMaxGroupDescriptionLength 63 + +typedef PGPChar8 PGPGroupName[ kPGPMaxGroupNameLength + 1 ]; +typedef PGPChar8 PGPGroupDescription[ kPGPMaxGroupDescriptionLength + 1 ]; + + +typedef struct PGPGroupSet * PGPGroupSetRef; +typedef struct PGPGroupIter * PGPGroupItemIterRef; + +#define kInvalidPGPGroupSetRef ((PGPGroupSetRef) NULL) +#define kInvalidPGPGroupItemIterRef ((PGPGroupItemIterRef) NULL) + +#define PGPGroupSetRefIsValid(ref) ((ref) != kInvalidPGPGroupSetRef) +#define PGPGroupItemIterRefIsValid(ref) ((ref) != kInvalidPGPGroupItemIterRef) + +/* any type will do that is distinct */ +typedef PGPUInt32 PGPGroupID; +#define kPGPInvalidGroupID ( (PGPGroupID)0 ) + +enum PGPGroupItemType_ +{ + kPGPGroupItem_KeyID = 1, + kPGPGroupItem_Group, + + PGP_ENUM_FORCE( PGPGroupItemType_) +}; +PGPENUM_TYPEDEF( PGPGroupItemType_, PGPGroupItemType ); + +/*____________________________________________________________________________ + A run-time group item, used when iterating through a group. + For client use; not necessarily the internal storage format. + + 'userValue' is *not* saved to disk. +____________________________________________________________________________*/ + +typedef struct PGPGroupItem +{ + PGPGroupItemType type; + PGPUserValue userValue; + + union + { + PGPGroupID groupID; + PGPKeyID keyID; + } u; +} PGPGroupItem; + + +typedef PGPInt32 (*PGPGroupItemCompareProc)( PGPGroupItem *, + PGPGroupItem *, PGPUserValue userValue ); + +/*____________________________________________________________________________ + Info obtained via PGPGetGroupInfo. +____________________________________________________________________________*/ + +typedef struct PGPGroupInfo +{ + PGPGroupID id; + PGPGroupName name; + PGPGroupName description; + PGPUserValue userValue; + +} PGPGroupInfo; + + +typedef PGPFlags PGPGroupItemIterFlags; +/* flag (1UL << 0 ) is reserved */ +#define kPGPGroupIterFlags_Recursive (PGPFlags)(1UL << 1 ) +#define kPGPGroupIterFlags_Keys (PGPFlags)(1UL << 2 ) +#define kPGPGroupIterFlags_Groups (PGPFlags)(1UL << 3 ) + +#define kPGPGroupIterFlags_AllKeysRecursive \ + ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_Keys ) + +#define kPGPGroupIterFlags_AllGroupsRecursive \ + ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_Groups ) + +#define kPGPGroupIterFlags_AllItems \ + ( kPGPGroupIterFlags_Keys | kPGPGroupIterFlags_Groups ) + +#define kPGPGroupIterFlags_AllRecursive \ + ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_AllItems ) + + + +#if PGP_MACINTOSH +#pragma options align=reset +#endif + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + Manipulating pgp group sets (PGPGroupSetRef) +____________________________________________________________________________*/ +/* create a new, empty groups collection */ +PGPError PGPNewGroupSet( PGPContextRef context, PGPGroupSetRef *outRef ); + +/* file is *not* left open; all data is loaded into memory */ +PGPError PGPNewGroupSetFromFile( PGPContextRef context, + PGPFileSpecRef file, + PGPGroupSetRef *outRef ); + +#if PGP_MACINTOSH || PGP_OSX +PGPError PGPNewGroupSetFromFSSpec( PGPContextRef context, + const struct FSSpec *spec, PGPGroupSetRef *outRef ); +#endif + +/* overwrites existing. Don't bother unless PGPGroupSetNeedsCommit() */ +PGPError PGPSaveGroupSetToFile( PGPGroupSetRef set, PGPFileSpecRef file ); + +/* free all data structures; be sure to save first if you want */ +PGPError PGPFreeGroupSet( PGPGroupSetRef set ); + + +/* has the group changed? */ +PGPBoolean PGPGroupSetNeedsCommit( PGPGroupSetRef set ); + +PGPContextRef PGPGetGroupSetContext( PGPGroupSetRef set ); + +/* export the groupset to a buffer. Use PGPFreeData to free the buffer */ +PGPError PGPExportGroupSetToBuffer( PGPGroupSetRef set, void **buffer, + PGPSize *bufferSize ); + +/* import a groupset from a buffer */ +PGPError PGPImportGroupSetFromBuffer(PGPContextRef context, void *buffer, + PGPSize bufSize, PGPGroupSetRef *outSet ); + +/*____________________________________________________________________________ + Manipulating groups + + Groups are always referred to by IDs which remain valid until the set + is disposed. +____________________________________________________________________________*/ + +/* initial parent ID is kPGPInvalidGroupID */ +PGPError PGPNewGroup( PGPGroupSetRef set, + const PGPChar8 * name, const PGPChar8 *description, + PGPGroupID *id ); + +PGPError PGPCountGroupsInSet( PGPGroupSetRef set, + PGPUInt32 *numGroups); +PGPError PGPGetIndGroupID( PGPGroupSetRef set, + PGPUInt32 groupIndex, PGPGroupID *id ); + +/* delete this group from the set */ +/* All references to it are removed in all sets */ +PGPError PGPDeleteGroup( PGPGroupSetRef set, PGPGroupID id ); + +/* delete the indexed item from the group */ +/* the item may be a group or a key */ +PGPError PGPDeleteIndItemFromGroup( PGPGroupSetRef set, + PGPGroupID id, PGPUInt32 item ); + +/* same as PGPDeleteIndItemFromGroup, but accepts an item */ +PGPError PGPDeleteItemFromGroup( PGPGroupSetRef set, + PGPGroupID id, PGPGroupItem const *item ); + + +PGPError PGPGetGroupInfo( PGPGroupSetRef set, + PGPGroupID id, PGPGroupInfo *info ); + +PGPError PGPSetGroupName( PGPGroupSetRef set, + PGPGroupID id, const PGPChar8 * name ); +PGPError PGPSetGroupUserValue( PGPGroupSetRef set, + PGPGroupID id, PGPUserValue userValue ); +PGPError PGPSetGroupDescription( PGPGroupSetRef set, + PGPGroupID id, const PGPChar8 * name ); + +/* 'item' specifies a group or a key id */ +/* you must fill the item in completely */ +PGPError PGPAddItemToGroup( PGPGroupSetRef set, + PGPGroupItem const *item, PGPGroupID group ); + + +PGPError PGPMergeGroupIntoDifferentSet( PGPGroupSetRef fromSet, + PGPGroupID fromID, PGPGroupSetRef toSet ); + +PGPError PGPMergeGroupSets( PGPGroupSetRef fromSet, + PGPGroupSetRef intoSet ); + +PGPError PGPCopyGroupSet(PGPGroupSetRef sourceSet, + PGPGroupSetRef *destSet); + +/*____________________________________________________________________________ + Manipulating group items +____________________________________________________________________________*/ + +/* count how many items there are in a group */ +/* totalItems includes keys and groups */ +PGPError PGPCountGroupItems( PGPGroupSetRef set, + PGPGroupID id, PGPBoolean recursive, + PGPUInt32 * numKeys, + PGPUInt32 * totalItems ); + +/* non-recursive call; index only applies to group itself */ +PGPError PGPGetIndGroupItem( PGPGroupSetRef set, + PGPGroupID id, PGPUInt32 groupIndex, PGPGroupItem * item ); + +/* use PGPGetIndGroupItem() if you want to get the user value */ +PGPError PGPSetIndGroupItemUserValue( PGPGroupSetRef set, + PGPGroupID id, PGPUInt32 groupIndex, PGPUserValue userValue ); + +PGPError PGPSortGroupItems( PGPGroupSetRef set, PGPGroupID id, + PGPGroupItemCompareProc, PGPUserValue userValue ); + +PGPError PGPSortGroupSet( PGPGroupSetRef set, + PGPGroupItemCompareProc, PGPUserValue userValue ); + +/*____________________________________________________________________________ + PGPGroupItemIterRef--iterator through group items. + + Special note: this is not a full-fledged iterator. You may *not* add + or delete items while iterating and you may only move forward. However, + you may change the values of items. +____________________________________________________________________________*/ + +PGPError PGPNewGroupItemIter( PGPGroupSetRef set, PGPGroupID id, + PGPGroupItemIterFlags flags, PGPGroupItemIterRef *iter ); + +PGPError PGPFreeGroupItemIter( PGPGroupItemIterRef iter ); + +/* returns kPGPError_EndOfIteration when done */ +PGPError PGPGroupItemIterNext( PGPGroupItemIterRef iter, + PGPGroupItem * item ); + +/*____________________________________________________________________________ + Group utilities +____________________________________________________________________________*/ + +/*____________________________________________________________________________ + Return the lowest validity of any item in the group + keyset should contain all keys available + It is not an error if keys can't be found; you may want to check + the not found count. + + The lowest validity is kPGPValidity_Invalid and kPGPValidity_Unknown + is never returned. +____________________________________________________________________________*/ +PGPError PGPGetGroupLowestValidity( PGPGroupSetRef set, PGPGroupID id, + PGPKeyDBRef keyDB, PGPValidity * lowestValidity, + PGPUInt32 * numKeysNotFound); + +/*____________________________________________________________________________ + All all the keys in the group (and its subgroups) to the keyset +____________________________________________________________________________*/ +PGPError PGPNewKeySetFromGroup( PGPGroupSetRef set, PGPGroupID id, + PGPKeyDBRef keyDB, PGPKeySetRef * resultSet, + PGPUInt32 * numKeysNotFound); + +/*____________________________________________________________________________ + Create a simple, flattened group of unique key IDs from the source group. + Note that sourceSet and destSet must be different. +____________________________________________________________________________*/ +PGPError PGPNewFlattenedGroupFromGroup(PGPGroupSetRef sourceSet, + PGPGroupID sourceID, PGPGroupSetRef destSet, + PGPGroupID *destID); + +/*____________________________________________________________________________ + Perform a "standard" sort on a group +____________________________________________________________________________*/ +PGPError PGPSortGroupSetStd( PGPGroupSetRef set, PGPKeyDBRef keydb ); + + +PGP_END_C_DECLARATIONS + +#endif /* ] PGP_DEPRECATED */ + +#endif /* ] Included_pgpGroups_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ + + + + + + + + diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHMAC.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHMAC.h new file mode 100644 index 0000000000..3dc58a6ff9 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHMAC.h @@ -0,0 +1,67 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpHMAC.h,v 1.6 2002/08/06 20:11:16 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpHMAC_h /* [ */ +#define Included_pgpHMAC_h + +#include "pgpPubTypes.h" + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + Create a new HMAC of the specified algorithm. + + If the algorithm is not available then kPGPError_AlgorithmNotAvailable is + returned. +____________________________________________________________________________*/ + +PGPError PGPNewHMACContext( PGPContextRef context, + PGPHashAlgorithm algorithm, PGPByte *secret, + PGPSize secretLen, PGPHMACContextRef *outRef ); + +/*____________________________________________________________________________ + Any existing intermediate HMAC is lost. +____________________________________________________________________________*/ + +PGPError PGPFreeHMACContext( PGPHMACContextRef ref ); + +/*____________________________________________________________________________ + Reset an HMAC as if it had been created anew. Any existing intermediate + hash is lost. +____________________________________________________________________________*/ + +PGPError PGPResetHMAC( PGPHMACContextRef ref ); + +/*____________________________________________________________________________ + Continue the HMAC, accumulating an intermediate result +____________________________________________________________________________*/ + +PGPError PGPContinueHMAC( PGPHMACContextRef ref, const void *in, + PGPSize numBytes ); + +/*____________________________________________________________________________ + Finalize the HMAC, depositing the result into 'hmacOut'. + + This size of the output will be the same size as the hash + algorithm output. +____________________________________________________________________________*/ + +PGPError PGPFinalizeHMAC( PGPHMACContextRef ref, void *hmacOut ); + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpHMAC_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHash.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHash.h new file mode 100644 index 0000000000..44225347ee --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHash.h @@ -0,0 +1,86 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpHash.h,v 1.6 2002/08/06 20:11:16 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpHashing_h /* [ */ +#define Included_pgpHashing_h + +#include "pgpPubTypes.h" + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + Create a new hash of the specified algorithm. + + If the algorithm is not available then kPGPError_AlgorithmNotAvailable is + returned. +____________________________________________________________________________*/ + +PGPError PGPNewHashContext( PGPContextRef context, + PGPHashAlgorithm algorithm, + PGPHashContextRef * outRef ); + +/*____________________________________________________________________________ + Any existing intermediate hash is lost. +____________________________________________________________________________*/ + +PGPError PGPFreeHashContext( PGPHashContextRef ref ); + +/*____________________________________________________________________________ + An exact duplicate of the hash is made. +____________________________________________________________________________*/ + +PGPError PGPCopyHashContext( PGPHashContextRef ref, + PGPHashContextRef * outRef); + +/*____________________________________________________________________________ + Reset a hash as if it had been created anew. Any existing intermediate + hash is lost. +____________________________________________________________________________*/ + +PGPError PGPResetHash( PGPHashContextRef ref ); + +/*____________________________________________________________________________ + Continue the hash, accumulating an intermediate result +____________________________________________________________________________*/ + +PGPError PGPContinueHash( PGPHashContextRef ref, const void *in, + PGPSize numBytes ); + +/*____________________________________________________________________________ + Finalize the hash, depositing the result into 'hashOut'. + + After calling this routine, the hash is reset via PGPResetHash(). + If you want an intermediate result, use PGPCopyHash() and finalize the + copy. +____________________________________________________________________________*/ + +PGPError PGPFinalizeHash( PGPHashContextRef ref, void *hashOut ); + +/*____________________________________________________________________________ + Determine size of resulting hash in bytes e.g. a 160 bit hash yields 20. + Used for generic code which may not know how big a hash is being produced. + + Question: can we reasonably assume 8 bits per byte? If not, how does + PGPFinalizeHash return its result? +____________________________________________________________________________*/ + +PGPError PGPGetHashSize( PGPHashContextRef ref, PGPSize *hashSize ); + + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpHashing_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHashWords.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHashWords.h new file mode 100644 index 0000000000..4c3c82cb8b --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpHashWords.h @@ -0,0 +1,40 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpHashWords.h,v 1.2 2004/01/03 02:25:31 bgaiser Exp $ +____________________________________________________________________________*/ +#ifndef HASHWORDLIST_H +#define HASHWORDLIST_H + +#include "pgpBase.h" + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + Hash word list types +____________________________________________________________________________*/ +enum PGPHashWordList_ +{ + kPGPHashWordList_Even = 0, + kPGPHashWordList_Odd = 1, + + PGP_ENUM_FORCE( PGPHashWordList_ ) +}; +PGPENUM_TYPEDEF( PGPHashWordList_, PGPHashWordList ); + +/*____________________________________________________________________________ + Hash word functions +____________________________________________________________________________*/ + + PGPError +PGPGetHashWordString( + PGPUInt32 index, + PGPHashWordList list, + PGPChar8 hashWordString[ 12 ]); + + +PGP_END_C_DECLARATIONS + +#endif + diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpIKE.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpIKE.h new file mode 100644 index 0000000000..23a28c8bc2 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpIKE.h @@ -0,0 +1,784 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpIKE.h,v 1.39 2003/09/24 03:09:32 ajivsov Exp $ +____________________________________________________________________________*/ +#ifndef Included_PGPike_h /* [ */ +#define Included_PGPike_h + +#include "pgpPubTypes.h" + +PGP_BEGIN_C_DECLARATIONS + +#if PGP_WIN32 +# pragma pack(push, 8) +#endif + +#ifdef _MSC_VER +#pragma warning (disable:4200) +#endif + +typedef struct PGPikeContext * PGPikeContextRef; + +#define kInvalidPGPikeContextRef ((PGPikeContextRef) NULL) +#define PGPikeContextRefIsValid( ref ) ( (ref) != kInvalidPGPikeContextRef ) + +#define kPGPike_CommonPort 500 +#define kPGPike_AuthMaximumKeySize (512/8) +#define kPGPike_ESPMaximumKeySize 32 /* 256 bits */ +#define kPGPike_MaxExplicitIVSize 16 +#define kPGPike_MaxTransforms 3 +#define kPGPike_DefaultKBLife 1048576 /* 1GB */ +#define kPGPike_DefaultSecLife 86400 /* 1 Day */ +#define kPGPike_UserDataSize 96 +#define kPGPike_XAuthStringLen 128 +#define kPGPike_XAuthMessageLen 256 + +typedef PGPByte PGPipsecSPI[4]; + +enum PGPikeDOI_ +{ + kPGPike_DOI_IKE = 0, + kPGPike_DOI_IPSEC = 1, + + PGP_ENUM_FORCE( PGPikeDOI_ ) +}; +PGPENUM_TYPEDEF( PGPikeDOI_, PGPikeDOI ); + +enum PGPikeAlert_ +{ + kPGPike_AL_None = 0, + + /* Error Types */ + kPGPike_AL_InvalidPayload = 1, + kPGPike_AL_DOIUnsupported = 2, + kPGPike_AL_SituationUnsupported = 3, + kPGPike_AL_InvalidCookie = 4, + kPGPike_AL_InvalidMajorVersion = 5, + kPGPike_AL_InvalidMinorVersion = 6, + kPGPike_AL_InvalidExchange = 7, + kPGPike_AL_InvalidFlags = 8, + kPGPike_AL_InvalidMessageID = 9, + kPGPike_AL_InvalidProtocolID = 10, + kPGPike_AL_InvalidSPI = 11, + kPGPike_AL_InvalidTransform = 12, + kPGPike_AL_InvalidAttribute = 13, + kPGPike_AL_NoProposalChoice = 14, + kPGPike_AL_BadProposal = 15, + kPGPike_AL_PayloadMalformed = 16, + kPGPike_AL_InvalidKey = 17, + kPGPike_AL_InvalidID = 18, + kPGPike_AL_InvalidCertEncoding = 19, + kPGPike_AL_InvalidCert = 20, + kPGPike_AL_UnsupportedCert = 21, + kPGPike_AL_InvalidCertAuthority = 22, + kPGPike_AL_InvalidHash = 23, + kPGPike_AL_AuthenticationFailed = 24, + kPGPike_AL_InvalidSignature = 25, + kPGPike_AL_AddressNotification = 26, + kPGPike_AL_NotifySALifetime = 27, + kPGPike_AL_CertUnavailable = 28, + kPGPike_AL_UnsupportedExchange = 29, + kPGPike_AL_UnequalPayloadLengths = 30, + + kPGPike_AL_NATTranslationFailure = 16300, + kPGPike_AL_LastErrorType = 16301, + + /* Status Types */ + kPGPike_AL_Connected = 16384, + kPGPike_AL_ResponderLifetime = 24576, /* IPSEC DOI */ + kPGPike_AL_ReplayStatus = 24577, /* IPSEC DOI */ + kPGPike_AL_InitialContact = 24578, /* IPSEC DOI */ + + PGP_ENUM_FORCE( PGPikeAlert_ ) +}; +PGPENUM_TYPEDEF( PGPikeAlert_, PGPikeAlert ); + +enum PGPikeInternalAlert_ +{ + kPGPike_IA_None = 0, + + kPGPike_IA_ResponseTimeout = 1, + kPGPike_IA_NoProposals = 2, + kPGPike_IA_NewPhase1SA = 3, + kPGPike_IA_NewPhase2SA = 4, + kPGPike_IA_DeadPhase1SA = 5, + kPGPike_IA_DeadPhase2SA = 6, + kPGPike_IA_TooManyExchanges = 7, + kPGPike_IA_XAuthSuccess = 8, + kPGPike_IA_XAuthFailed = 9, + + PGP_ENUM_FORCE( PGPikeInternalAlert_ ) +}; +PGPENUM_TYPEDEF( PGPikeInternalAlert_, PGPikeInternalAlert ); + +enum PGPikePref_ +{ + kPGPike_PF_None = 0, + + kPGPike_PF_Expiration = 1, + kPGPike_PF_AllowedAlgorithms = 2, + kPGPike_PF_IKEProposals = 3, + kPGPike_PF_IPSECProposals = 4, + + PGP_ENUM_FORCE( PGPikePref_ ) +}; +PGPENUM_TYPEDEF( PGPikePref_, PGPikePref ); + +enum PGPipsecEncapsulation_ +{ + kPGPike_PM_None = 0, + + kPGPike_PM_Tunnel = 1, + kPGPike_PM_Transport = 2, + kPGPike_PM_UDPencapsulatedTunnel = 61443, + kPGPike_PM_UDPencapsulatedTransport = 61444, + + PGP_ENUM_FORCE( PGPipsecEncapsulation_ ) +}; +PGPENUM_TYPEDEF( PGPipsecEncapsulation_, PGPipsecEncapsulation ); + +enum PGPikeLifeType_ +{ + kPGPike_LT_None = 0, + + kPGPike_LT_Seconds = 1, + kPGPike_LT_Kilobytes = 2, + + PGP_ENUM_FORCE( PGPikeLifeType_ ) +}; +PGPENUM_TYPEDEF( PGPikeLifeType_, PGPikeLifeType ); + +enum PGPipsecIdentity_ +{ + kPGPike_ID_None = 0, + + kPGPike_ID_IPV4_Addr, + kPGPike_ID_FQDN, + kPGPike_ID_UserFQDN, + kPGPike_ID_IPV4_Addr_Subnet, + kPGPike_ID_IPV6_Addr, + kPGPike_ID_IPV6_Addr_Subnet, + kPGPike_ID_IPV4_Addr_Range, + kPGPike_ID_IPV6_Addr_Range, + kPGPike_ID_DER_ASN1_DN, + kPGPike_ID_DER_ASN1_GN, + kPGPike_ID_Key_ID, /* used for PGP fingerprint */ + + PGP_ENUM_FORCE( PGPipsecIdentity_ ) +}; +PGPENUM_TYPEDEF( PGPipsecIdentity_, PGPipsecIdentity ); + +/* If it doesn't say supported, it isn't. */ +enum PGPipsecAHTransformID_ +{ + kPGPike_AH_None = 0, + + kPGPike_AH_MD5 = 2, /* supported */ + kPGPike_AH_SHA = 3, /* supported */ + kPGPike_AH_DES = 4, + kPGPike_AH_SHA2_256 = 5, /* supported */ + kPGPike_AH_SHA2_384 = 6, /* supported */ + kPGPike_AH_SHA2_512 = 7, /* supported */ + + PGP_ENUM_FORCE( PGPipsecAHTransformID_ ) +}; +PGPENUM_TYPEDEF( PGPipsecAHTransformID_, PGPipsecAHTransformID ); + +enum PGPipsecAuthAttribute_ +{ + kPGPike_AA_None = 0, + + kPGPike_AA_HMAC_MD5 = 1, /* supported */ + kPGPike_AA_HMAC_SHA = 2, /* supported */ + kPGPike_AA_DES_MAC = 3, + kPGPike_AA_KPDK = 4, + kPGPike_AA_HMAC_SHA2_256 = 5, /* supported */ + kPGPike_AA_HMAC_SHA2_384 = 6, /* supported */ + kPGPike_AA_HMAC_SHA2_512 = 7, /* supported */ + + PGP_ENUM_FORCE( PGPipsecAuthAttribute_ ) +}; +PGPENUM_TYPEDEF( PGPipsecAuthAttribute_, PGPipsecAuthAttribute ); + +enum PGPipsecESPTransformID_ +{ + kPGPike_ET_DES_IV64 = 1, /* supported */ + kPGPike_ET_DES = 2, /* supported */ + kPGPike_ET_3DES = 3, /* supported */ + kPGPike_ET_RC5 = 4, + kPGPike_ET_IDEA = 5, + kPGPike_ET_CAST = 6, /* supported */ + kPGPike_ET_Blowfish = 7, + kPGPike_ET_3IDEA = 8, + kPGPike_ET_DES_IV32 = 9, + kPGPike_ET_RC4 = 10, + kPGPike_ET_NULL = 11, /* supported */ + kPGPike_ET_AES = 12, + + PGP_ENUM_FORCE( PGPipsecESPTransformID_ ) +}; +PGPENUM_TYPEDEF( PGPipsecESPTransformID_, PGPipsecESPTransformID ); + +/* IPCOMP is not supported by this version of PGPike */ +enum PGPipsecIPCOMPTransformID_ +{ + kPGPike_IC_None = 0, + + kPGPike_IC_OUI = 1, + kPGPike_IC_Deflate = 2, /* supported */ + kPGPike_IC_LZS = 3, /* supported */ + kPGPike_IC_V42bis = 4, + + PGP_ENUM_FORCE( PGPipsecIPCOMPTransformID_ ) +}; +PGPENUM_TYPEDEF( PGPipsecIPCOMPTransformID_, PGPipsecIPCOMPTransformID ); + +enum PGPipsecProtocol_ +{ + kPGPike_PR_None = 0, + kPGPike_PR_IKE = 1, + kPGPike_PR_AH = 2, + kPGPike_PR_ESP = 3, + kPGPike_PR_IPCOMP = 4, + + PGP_ENUM_FORCE( PGPipsecProtocol_ ) +}; +PGPENUM_TYPEDEF( PGPipsecProtocol_, PGPipsecProtocol ); + +enum PGPikeGroupID_ +{ + kPGPike_GR_None = 0, /* supported */ + + kPGPike_GR_MODPOne = 1, /* supported */ + kPGPike_GR_MODPTwo = 2, /* supported */ + kPGPike_GR_MODPFive = 5, /* supported */ + + kPGPike_GR_ECSix = 6, /* supported */ + kPGPike_GR_ECSeven = 7, /* supported */ + + kPGPike_GR_ECEight = 8, /* supported */ + kPGPike_GR_ECNine = 9, /* supported */ + + kPGPike_GR_MODP2048 = 42048,/* unassigned */ + kPGPike_GR_MODP3072 = 43072,/* unassigned */ + kPGPike_GR_MODP4096 = 44096,/* unassigned */ + kPGPike_GR_MODP6144 = 46144,/* unassigned */ + kPGPike_GR_MODP8192 = 48192,/* unassigned */ + + PGP_ENUM_FORCE( PGPikeGroupID_ ) +}; +PGPENUM_TYPEDEF( PGPikeGroupID_, PGPikeGroupID ); + +enum PGPikeCipher_ +{ + kPGPike_SC_None = 0, + + kPGPike_SC_DES_CBC = 1, /* supported */ + kPGPike_SC_IDEA_CBC = 2, + kPGPike_SC_Blowfish_CBC = 3, + kPGPike_SC_RC5_R16_B64_CBC = 4, + kPGPike_SC_3DES_CBC = 5, /* supported */ + kPGPike_SC_CAST_CBC = 6, /* supported */ + kPGPike_SC_AES_CBC = 7, + + PGP_ENUM_FORCE( PGPikeCipher_ ) +}; +PGPENUM_TYPEDEF( PGPikeCipher_, PGPikeCipher ); + +enum PGPikeHash_ +{ + kPGPike_HA_None = 0, + + kPGPike_HA_MD5 = 1, /* supported */ + kPGPike_HA_SHA1 = 2, /* supported */ + kPGPike_HA_Tiger = 3, + kPGPike_HA_SHA2_256 = 4, + kPGPike_HA_SHA2_384 = 5, + kPGPike_HA_SHA2_512 = 6, + + PGP_ENUM_FORCE( PGPikeHash_ ) +}; +PGPENUM_TYPEDEF( PGPikeHash_, PGPikeHash ); + +enum PGPikeAuthMethod_ +{ + kPGPike_AM_None = 0, + + kPGPike_AM_PreSharedKey = 1, /* supported */ + kPGPike_AM_DSS_Sig = 2, /* supported */ + kPGPike_AM_RSA_Sig = 3, /* supported */ + kPGPike_AM_RSA_Encrypt = 4, + kPGPike_AM_RSA_Encrypt_R = 5, + + kPGPike_AM_HAuth_InitRSA = 64221, + kPGPike_AM_HAuth_RespRSA = 64222, + kPGPike_AM_HAuth_InitDSS = 64223, + kPGPike_AM_HAuth_RespDSS = 64224, + + kPGPike_AM_XAuth_InitPreShared = 65001, + kPGPike_AM_XAuth_RespPreShared = 65002, + kPGPike_AM_XAuth_InitDSS = 65003, + kPGPike_AM_XAuth_RespDSS = 65004, + kPGPike_AM_XAuth_InitRSA = 65005, + kPGPike_AM_XAuth_RespRSA = 65006, + kPGPike_AM_XAuth_InitRSAEncryption = 65007, + kPGPike_AM_XAuth_RespRSAEncryption = 65008, + kPGPike_AM_XAuth_InitRSAREncryption = 65009, + kPGPike_AM_XAuth_RespRSAREncryption = 65010, + + PGP_ENUM_FORCE( PGPikeAuthMethod_ ) +}; +PGPENUM_TYPEDEF( PGPikeAuthMethod_, PGPikeAuthMethod ); + +enum PGPikeAuthStyle_ +{ + kPGPike_AS_Normal = 0, + + kPGPike_AS_XAuth = 1, + kPGPike_AS_HybridAuth = 2, + + PGP_ENUM_FORCE( PGPikeAuthStyle_ ) +}; +PGPENUM_TYPEDEF( PGPikeAuthStyle_, PGPikeAuthStyle ); + +enum PGPikeXAuthType_ +{ + kPGPike_XT_Generic = 0, + + kPGPike_XT_RADIUS_CHAP = 1, + kPGPike_XT_OTP = 2, + kPGPike_XT_SKEY = 3, + + PGP_ENUM_FORCE( PGPikeXAuthType_ ) +}; +PGPENUM_TYPEDEF( PGPikeXAuthType_, PGPikeXAuthType ); + +enum PGPikeEncapsulateMode_ +{ + kPGPike_EM_Auto = 0, + + kPGPike_EM_Always = 1, + kPGPike_EM_Never = 2, + + PGP_ENUM_FORCE( PGPikeEncapsulateMode_ ) +}; +PGPENUM_TYPEDEF( PGPikeEncapsulateMode_, PGPikeEncapsulateMode ); + +typedef struct PGPipsecESPTransform +{ + PGPipsecESPTransformID cipher; + PGPUInt32 keyLength; + /* cipher key bit size, must be 0 for all except AES */ + PGPipsecAuthAttribute authAttr; + PGPipsecEncapsulation mode; +} PGPipsecESPTransform; + +typedef struct PGPipsecAHTransform +{ + PGPipsecAHTransformID authAlg; + PGPipsecAuthAttribute authAttr; + PGPipsecEncapsulation mode; +} PGPipsecAHTransform; + +typedef struct PGPipsecIPCOMPTransform +{ + PGPipsecIPCOMPTransformID compAlg; +} PGPipsecIPCOMPTransform; + +typedef struct PGPikeTransform +{ + PGPikeAuthMethod authMethod; + PGPikeHash hash; + PGPikeCipher cipher; + PGPUInt32 keyLength; /* cipher key bit size, must be 0 for all except AES */ + PGPikeGroupID groupID; +} PGPikeTransform; + +typedef struct PGPipsecTransform +{ + PGPBoolean useESP; + PGPipsecESPTransform esp; + + PGPBoolean useAH; + PGPipsecAHTransform ah; + + PGPBoolean useIPCOMP; + PGPipsecIPCOMPTransform ipcomp; + + PGPikeGroupID groupID; +} PGPipsecTransform; + +typedef struct PGPipsecDOIParams +{ + PGPipsecSPI inSPI; + PGPipsecSPI outSPI; + PGPipsecProtocol protocol; + + union + { + struct + { + PGPipsecAHTransform t; + PGPByte inAuthKey[kPGPike_AuthMaximumKeySize]; + PGPByte outAuthKey[kPGPike_AuthMaximumKeySize]; + } ah; + + struct + { + PGPipsecESPTransform t; + PGPByte inESPKey[kPGPike_ESPMaximumKeySize]; + PGPByte outESPKey[kPGPike_ESPMaximumKeySize]; + PGPByte inAuthKey[kPGPike_AuthMaximumKeySize]; + PGPByte outAuthKey[kPGPike_AuthMaximumKeySize]; + PGPByte explicitIV[kPGPike_MaxExplicitIVSize]; + } esp; + + struct + { + PGPipsecIPCOMPTransform t; + } ipcomp; + } u; +} PGPipsecDOIParams; + +typedef struct PGPipsecSA +{ + struct PGPipsecSA * nextSA; /* INTERNAL USE ONLY */ + struct PGPipsecSA * prevSA; /* INTERNAL USE ONLY */ + PGPUInt32 ipAddress; /* PreNATted(Original) IP Address */ + PGPBoolean destIsRange; /* dest is IP range */ + PGPUInt32 ipAddrStart; /* IP address */ + PGPUInt32 ipMaskEnd; /* mask or end range IP address */ + PGPByte ipProtocol; /* 0 if all protocols */ + PGPUInt16 ipPort; /* 0 if all ports */ + + PGPBoolean bNATTraversal; /* NAT Encapsulation is enabled if true */ + PGPBoolean bIsLocalIPNAT; /* if non-zero, our local IP is natted */ + PGPBoolean bIsRemoteIPNAT; /* if non-zero, remote IP is NATed */ + PGPUInt32 natIPAddress; /* NATed Dest IP Address, 0 if not NATed */ + PGPUInt16 nboNATPort; /* NATed Dest Port value */ + + PGPUInt32 assignedIP; /* if non-zero, use as tunnel IP */ + PGPUInt32 assignedDNS; /* if non-zero, use as tunnel DNS */ + PGPUInt32 assignedWINS; /* if non-zero, use as tunnel WINS */ + + PGPBoolean initiator; /* was this SA initiated locally */ + PGPBoolean activeIn; /* use for inbound data */ + PGPBoolean activeOut; /* use for outbound data */ + PGPUInt32 kbLifeTime; /* max KB to be sent on this SA */ + PGPUInt32 secLifeTime; /* max seconds this SA will live */ + /* 0 means no limit for either */ + PGPTime birthTime; + + PGPUInt16 numTransforms; + PGPipsecDOIParams transform[kPGPike_MaxTransforms]; + + PGPTime termSchedule; /* SA will be terminated, private */ + PGPByte userData[kPGPike_UserDataSize];/* for your use */ +} PGPipsecSA; + +/* When sent a kPGPike_MT_SARequest, pgpIKE will expect that + all fields below will be filled in. The approved member is + irrelevant in that case. + + When you are called with kPGPike_MT_PolicyCheck, pgpIKE will + set everything to 0 except the IP address. You are expected + to fill in the other fields with local policy. The PolicyCheck + is used for remote-initiated SA negotiation. Since you cannot + predict which remote network might be trying to communicate + with us, you should leave the destIsRange/ipAddrStart/ipMaskEnd + and ipPort/ipProtocol fields set to 0 for this message. You + will be called to check those later with the ClientIDCheck. +*/ +typedef struct PGPikeMTSASetup +{ + PGPBoolean approved; /* > */ + + PGPUInt32 ipAddress; /* destination */ + PGPUInt32 localIPAddress; /* source */ + PGPByte ipProtocol; + PGPUInt16 ipPort; + PGPByte * sharedKey; /* null if none, data will be copied */ + PGPSize sharedKeySize; /* w/o NULL-terminate */ + PGPBoolean aggressive; /* set for aggressive mode */ + PGPBoolean lightweight; /* only for SARequest, set to + TRUE for only 1 retry */ + /* set the fields below to use tunnel mode */ + PGPBoolean destIsRange; + PGPUInt32 ipAddrStart; + PGPUInt32 ipMaskEnd; + + PGPBoolean virtualIP; /* whether to use mode-cfg */ + PGPikeAuthStyle authStyle; /* whether to use xauth/hybrid */ + PGPikeEncapsulateMode encapsulateMode; /* Force NAT Traversal mode */ + + PGPipsecIdentity idType; /* only useful in shared key mode */ + PGPByte * idData; /* data will be copied */ + PGPSize idDataSize; /* this is the Phase 1 ID */ +} PGPikeMTSASetup; + +/* + When you are called with a kPGPike_MT_ClientIDCheck, all fields + will be set appropriately. If the destIsRange/ipAddrStart/ipMaskEnd + triad is permitted to be represented by the IP address, set + the approved field to true. This message is only sent in the case + where the remote side is the initiator and you have already been + called with a kPGPike_MT_PolicyCheck message. +*/ +typedef struct PGPikeMTClientIDCheck +{ + PGPBoolean approved; /* > */ + + PGPUInt32 ipAddress; + PGPByte ipProtocol; + PGPUInt16 ipPort; + + PGPBoolean destIsRange; + PGPUInt32 ipAddrStart; + PGPUInt32 ipMaskEnd; +} PGPikeMTClientIDCheck; + +typedef struct PGPikeMTSAEstablished +{ + PGPipsecSA * sa; + PGPBoolean remoteValid; + PGPByte * remoteAuthKey; /* binary exported key data */ + PGPSize remoteAuthKeySize; +} PGPikeMTSAEstablished; + +typedef struct PGPikeMTSAFailed +{ + PGPUInt32 ipAddress; /* destination */ + PGPByte ipProtocol; + PGPUInt16 ipPort; + + PGPBoolean destIsRange; + PGPUInt32 ipAddrStart; + PGPUInt32 ipMaskEnd; + +} PGPikeMTSAFailed; + +typedef struct PGPikeMTCert +{ + PGPUInt32 ipAddress; /* < */ + PGPKeyDBRef baseKeyDB; /* > */ + PGPKeyDBObjRef authObj; /* > PGP key or X.509 cert */ + + PGPBoolean isPassKey; /* > */ + void * pass; /* > null-term if passphrase, Unicode, copied */ + PGPSize passLength; /* > in PGPChar8s */ +} PGPikeMTCert; + +typedef struct PGPikeMTRemoteCert +{ + PGPBoolean approved; /* > */ + PGPBoolean valid; /* > */ + PGPUInt32 ipAddress; /* < */ + PGPKeyDBObjRef remoteObj; /* < PGPkey or X.509 cert */ + PGPKeyDBRef remoteKeyDB; /* < any other keys/certs are part of + this cert's chain */ +} PGPikeMTRemoteCert; + +typedef struct PGPikeMTPacket +{ + PGPUInt32 ipAddress; /* source or destination */ + PGPUInt16 port; /* usually UDP 500, but might not be */ + PGPSize packetSize; + PGPByte * packet; /* msg *sender* must free this */ +} PGPikeMTPacket; + +typedef struct PGPikeMTIdentity +{ + PGPBoolean active; /* TRUE = set it, FALSE= dead */ + PGPUInt32 ipAddress; /* Gateway IP */ + PGPUInt32 assignedIP; + PGPUInt32 assignedDNS; + PGPUInt32 assignedWINS; +} PGPikeMTIdentity; + +typedef struct PGPikeMTAlert +{ + PGPikeAlert alert; + PGPUInt32 ipAddress; + PGPikeInternalAlert value; /* used if alert is kPGPike_AL_None */ + PGPBoolean remoteGenerated; +} PGPikeMTAlert; + +typedef PGPUInt32 PGPikeAESKeyLengthMask; + +#define kPGPike_AESKeyLength128 1 +#define kPGPike_AESKeyLength192 2 +#define kPGPike_AESKeyLength256 4 +#define kPGPike_AESKeyLengthAll 7 + +typedef struct PGPikeAllowedAlgorithms +{ + PGPBoolean cast5; + PGPBoolean tripleDES; + PGPBoolean singleDES; + PGPikeAESKeyLengthMask aes; + PGPBoolean espNULL; + + PGPBoolean sha1; + PGPBoolean md5; + PGPBoolean sha2_256; + PGPBoolean sha2_384; + PGPBoolean sha2_512; + PGPBoolean noAuth; + + PGPBoolean lzs; + PGPBoolean deflate; + + PGPBoolean modpOne768; + PGPBoolean modpTwo1024; + PGPBoolean modpFive1536; + + PGPBoolean ec2n163; + PGPBoolean ec2n283; + + PGPBoolean modp2048; + PGPBoolean modp3072; + PGPBoolean modp4096; + PGPBoolean modp6144; + PGPBoolean modp8192; + +} PGPikeAllowedAlgorithms; + +typedef struct PGPikeMTPref +{ + PGPikePref pref; + + union + { + struct + { + PGPUInt32 kbLifeTimeIKE; + PGPUInt32 secLifeTimeIKE; + PGPUInt32 kbLifeTimeIPSEC; + PGPUInt32 secLifeTimeIPSEC; + } expiration; /* kPGPike_PF_Expiration */ + + struct + { + PGPUInt32 numTransforms; + PGPikeTransform * t; + } ikeProposals; /* kPGPike_PF_IKEProposals */ + + + struct + { + PGPUInt32 numTransforms; + PGPipsecTransform * t; + } ipsecProposals; /* kPGPike_PF_IPSECProposals */ + + PGPikeAllowedAlgorithms allowedAlgorithms; + /*kPGPike_PF_AllowedAlgorithms*/ + } u; +} PGPikeMTPref; + +/* This message will be sent to check extended authentication. The buffer + will be freed after your callback is called, so if you need it, + copy the data elsewhere. You must retrieve the information and then + send an AuthCheck message back to IKE with the contents filled in, + and all contents preserved other than what you filled in. The message + you send back is your memory, IKE will not free it. */ +typedef struct PGPikeMTAuthCheck +{ + PGPBoolean success; /* set to true unless user aborts */ + PGPUInt32 gatewayIP; + PGPikeXAuthType xauthType; + PGPUInt16 transactionID; /* private */ + PGPBoolean includeType; /* private */ + + PGPBoolean useUserName; + PGPBoolean usePassword; + PGPBoolean usePasscode; + PGPBoolean useMessage; + PGPBoolean useChallenge; + PGPBoolean useDomain; + + PGPChar8 userName[kPGPike_XAuthStringLen]; + PGPChar8 password[kPGPike_XAuthStringLen]; + PGPChar8 passcode[kPGPike_XAuthStringLen]; + PGPChar8 message[kPGPike_XAuthMessageLen]; + PGPChar8 challenge[kPGPike_XAuthStringLen]; + PGPChar8 domain[kPGPike_XAuthStringLen]; + PGPSize challengeSize; +} PGPikeMTAuthCheck; + +enum PGPikeMessageType_ +{ + /* + Message types followed by ">" may be sent to PGPike + Message typed followed by "<" may be sent by PGPike + */ + kPGPike_MT_Idle = 0, /* > call this often */ + kPGPike_MT_SARequest, /* > PGPikeMTSASetup */ + kPGPike_MT_SARequestFailed, /* < PGPikeMTSAFailed */ + kPGPike_MT_SAEstablished, /* < PGPikeMTSAEstablished */ + kPGPike_MT_SARekey, /* > PGPipsecSA */ + kPGPike_MT_SADied, /* >< PGPipsecSA */ + kPGPike_MT_SAUpdate, /* < PGPipsecSA */ + kPGPike_MT_SAKillAll, /* > none */ + + kPGPike_MT_PolicyCheck, /* < PGPikeMTSASetup */ + kPGPike_MT_ClientIDCheck, /* < PGPikeMTClientIDCheck */ + kPGPike_MT_AuthCheck, /* >< PGPikeMTAuthCheck */ + kPGPike_MT_LocalPGPCert, /* < PGPikeMTCert */ + kPGPike_MT_LocalX509Cert, /* < PGPikeMTCert */ + kPGPike_MT_RemoteCert, /* < PGPikeMTRemoteCert */ + kPGPike_MT_Identity, /* < PGPikeMTIdentity */ + + kPGPike_MT_Packet, /* >< PGPikeMTPacket */ + kPGPike_MT_Alert, /* < PGPikeMTAlert */ + + kPGPike_MT_Pref, /* > PGPikeMTPref */ + + kPGPike_MT_DebugLog, /* < PGPChar8 * */ + + PGP_ENUM_FORCE( PGPikeMessageType_ ) +}; +PGPENUM_TYPEDEF( PGPikeMessageType_, PGPikeMessageType ); + +typedef PGPError (* PGPikeMessageProcPtr)( + PGPikeContextRef ike, + void * inUserData, + PGPikeMessageType msg, + void * data ); + +PGPError PGPNewIKEContext( + PGPContextRef context, + PGPikeMessageProcPtr ikeMessageProc, + void * inUserData, + PGPikeContextRef * outRef ); + +PGPError PGPFreeIKEContext( + PGPikeContextRef ref ); + +/* Any error from PGPikeProcessMessage is fatal. Non-fatal + errors are sent through the kPGPike_MT_Alert message. */ + +PGPError PGPikeProcessMessage( + PGPikeContextRef ref, + PGPikeMessageType msg, + void * data ); + + +#if PGP_WIN32 +# pragma pack(pop) +#endif + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_PGPike_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpKeyServer.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpKeyServer.h new file mode 100644 index 0000000000..27594ea8b1 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpKeyServer.h @@ -0,0 +1,339 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpKeyServer.h,v 1.20 2004/01/23 08:12:49 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpKeyServer_h +#define Included_pgpKeyServer_h + +#include "pgpOptionList.h" +#include "pgpErrors.h" +#include "pgpGroups.h" +#include "pgpTLS.h" + + +enum PGPKeyServerState_ +{ + kPGPKeyServerState_Invalid = 0, + kPGPKeyServerState_Opening = 1, + kPGPKeyServerState_Querying = 2, + kPGPKeyServerState_ReceivingResults = 3, + kPGPKeyServerState_ProcessingResults = 4, + kPGPKeyServerState_Uploading = 5, + kPGPKeyServerState_Deleting = 6, + kPGPKeyServerState_Disabling = 7, + kPGPKeyServerState_Closing = 8, + + kPGPKeyServerState_TLSUnableToSecureConnection = 9, + kPGPKeyServerState_TLSConnectionSecured = 10, + + PGP_ENUM_FORCE(PGPKeyServerState_) +}; + +PGPENUM_TYPEDEF(PGPKeyServerState_, PGPKeyServerState); + +enum PGPKeyServerProtocol_ +{ + kPGPKeyServerProtocol_Invalid = 0, + kPGPKeyServerProtocol_LDAP = 1, + kPGPKeyServerProtocol_HTTP = 2, + kPGPKeyServerProtocol_LDAPS = 3, + kPGPKeyServerProtocol_HTTPS = 4, + + PGP_ENUM_FORCE( PGPKeyServerProtocol_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerProtocol_, PGPKeyServerProtocol ); + +enum PGPKeyServerClass_ +{ + kPGPKeyServerClass_Invalid = 0, + kPGPKeyServerClass_PGP = 1, + kPGPKeyServerClass_LDAPX509 = 2, + kPGPKeyServerClass_LDAPPGP = 3, /* deprecated, use kPGPKeyServerClass_PGP instead */ + + /* CA types */ + kPGPKeyServerClass_NetToolsCA = 10, + kPGPKeyServerClass_Verisign = 11, + kPGPKeyServerClass_Entrust = 12, + kPGPKeyServerClass_Netscape = 13, + kPGPKeyServerClass_Microsoft = 14, + + PGP_ENUM_FORCE( PGPKeyServerClass_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerClass_, PGPKeyServerClass ); + +enum PGPKeyServerKeySpace_ /* These are only valid for LDAP keyservers */ +{ + kPGPKeyServerKeySpace_Invalid = 0, + kPGPKeyServerKeySpace_Default = 1, + kPGPKeyServerKeySpace_Normal = 2, + kPGPKeyServerKeySpace_Pending = 3, + + PGP_ENUM_FORCE( PGPKeyServerKeySpace_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerKeySpace_, PGPKeyServerKeySpace ); + +enum PGPKeyServerAccessType_ /* These are only valid for LDAP keyservers */ +{ + kPGPKeyServerAccessType_Invalid = 0, + kPGPKeyServerAccessType_Default = 1, + kPGPKeyServerAccessType_Normal = 2, + kPGPKeyServerAccessType_Administrator = 3, + + PGP_ENUM_FORCE( PGPKeyServerAccessType_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerAccessType_, PGPKeyServerAccessType ); + +enum PGPProxyServerType_ +{ + kPGPProxyServerType_Invalid = 0, + kPGPProxyServerType_HTTP = 1, + kPGPProxyServerType_HTTPS = 2, + + PGP_ENUM_FORCE(PGPProxyServerType_) +}; + +PGPENUM_TYPEDEF(PGPProxyServerType_, PGPProxyServerType); + +/* PGPKeyServerMonitorValues are null terminated linked lists. + The values member is a null terminated array of char*s. +*/ + +typedef struct PGPKeyServerMonitorValues +{ + PGPChar8 * name; + PGPChar8 ** values; + struct PGPKeyServerMonitorValues * next; +} PGPKeyServerMonitorValues; + +typedef struct PGPKeyServerMonitor +{ + PGPKeyServerRef keyServerRef; + PGPKeyServerMonitorValues * valuesHead; +} PGPKeyServerMonitor; + + +typedef struct PGPKeyServerThreadStorage * PGPKeyServerThreadStorageRef; +# define kInvalidPGPKeyServerThreadStorageRef \ + ((PGPKeyServerThreadStorageRef) NULL) +#define PGPKeyServerThreadStorageRefIsValid(ref) \ + ((ref) != kInvalidPGPKeyServerThreadStorageRef) + +PGP_BEGIN_C_DECLARATIONS + + +/* Use the idle event handler to receive periodic idle events during + network calls. Usually this is used only in non-preemptive multi-tasking + OSes to allow yielding in threads. Pre-emptive multi-tasking systems + should probably not use the call as it interrupts the efficient wait state + of threads waiting on network calls. + + Idle event handlers need to be added on a per thread basis. + + Returning an error from the idle event handler will cause the keyserver + to quit processing and to return a kPGPError_UserAbort. */ +PGPError PGPSetKeyServerIdleEventHandler( + PGPEventHandlerProcPtr inCallback, + PGPUserValue inUserData); + +PGPError PGPGetKeyServerIdleEventHandler( + PGPEventHandlerProcPtr * outCallback, + PGPUserValue * outUserData); + +/* Network library options */ + +#undef PGPONetURL +PGPOptionListRef PGPONetURL(PGPContextRef context, const PGPChar8 *url); + +#undef PGPONetHostName +PGPOptionListRef PGPONetHostName(PGPContextRef context, + const PGPChar8 *hostName, PGPUInt16 port); + +PGPOptionListRef PGPONetHostAddress(PGPContextRef context, + PGPUInt32 hostAddress, PGPUInt16 port); + +PGPOptionListRef PGPONetConnectTimeout(PGPContextRef context, + PGPUInt32 timeout); + +PGPOptionListRef PGPONetReadTimeout(PGPContextRef context, + PGPUInt32 timeout); + +PGPOptionListRef PGPONetWriteTimeout(PGPContextRef context, + PGPUInt32 timeout); + +PGPOptionListRef PGPOKeyServerProtocol(PGPContextRef context, + PGPKeyServerProtocol serverProtocol); + +PGPOptionListRef PGPOKeyServerKeySpace(PGPContextRef context, + PGPKeyServerKeySpace serverSpace); + +#undef PGPOKeyServerKeyStoreDN +PGPOptionListRef PGPOKeyServerKeyStoreDN(PGPContextRef context, + const PGPChar8 *szKeyStoreDn); + +PGPOptionListRef PGPOKeyServerAccessType(PGPContextRef context, + PGPKeyServerAccessType accessType); + +PGPOptionListRef PGPOKeyServerCAKey(PGPContextRef context, + PGPKeyDBObjRef caKeyDBObjRef); + +PGPOptionListRef PGPOKeyServerRequestKey(PGPContextRef context, + PGPKeyDBObjRef requestKeyDBObjRef); + +PGPOptionListRef PGPOKeyServerSearchKey(PGPContextRef context, + PGPKeyDBObjRef searchKeyDBObjRef); + +PGPOptionListRef PGPOKeyServerSearchFilter(PGPContextRef context, + PGPFilterRef searchFilter); + +/* Static storage creation */ +PGPError PGPKeyServerCreateThreadStorage( + PGPKeyServerThreadStorageRef * outPreviousStorage); +PGPError PGPKeyServerDisposeThreadStorage( + PGPKeyServerThreadStorageRef inPreviousStorage); + +/* Initialize and close the keyserver library */ +PGPError PGPKeyServerInit(void); + +PGPError PGPKeyServerCleanup(void); + + +/* Creating and freeing a keyserver ref. */ +PGPError PGPNewKeyServer( + PGPContextRef inContext, + PGPKeyServerClass inClass, + PGPKeyServerRef *outKeyServerRef, + PGPOptionListRef firstOption, + ... ); + +PGPError PGPFreeKeyServer(PGPKeyServerRef inKeyServerRef); +PGPError PGPIncKeyServerRefCount(PGPKeyServerRef inKeyServerRef); + + +/* Set and get the keyserver's event handler. Note that returning an error + for a keyserver event will abort the current call. */ +PGPError PGPSetKeyServerEventHandler( + PGPKeyServerRef inKeyServerRef, + PGPEventHandlerProcPtr inCallback, + PGPUserValue inUserData); + +PGPError PGPGetKeyServerEventHandler( + PGPKeyServerRef inKeyServerRef, + PGPEventHandlerProcPtr * outCallback, + PGPUserValue * outUserData); + + +/* Canceling a call to a keyserver. This is the only call that can be made + to a keyserver that is currently in another call. Also, once you have + returned from a canceled call, you may only close the keyserver. */ +PGPError PGPCancelKeyServerCall(PGPKeyServerRef inKeyServerRef); + + +/* Opening and closing the keyserver. A keyserver ref can be opened and + closed multiple times as necessary. */ +PGPError PGPKeyServerOpen(PGPKeyServerRef inKeyServerRef, + PGPtlsSessionRef inTLSSessionRef); + +PGPError PGPKeyServerClose(PGPKeyServerRef inKeyServerRef); + + +/* Get keyserver info. */ +PGPError PGPGetKeyServerTLSSession(PGPKeyServerRef inKeyServerRef, + PGPtlsSessionRef * outTLSSessionRef); + +PGPError PGPGetKeyServerProtocol(PGPKeyServerRef inKeyServerRef, + PGPKeyServerProtocol * outType); + +PGPError PGPGetKeyServerAccessType(PGPKeyServerRef inKeyServerRef, + PGPKeyServerAccessType * outAccessType); + +PGPError PGPGetKeyServerKeySpace(PGPKeyServerRef inKeyServerRef, + PGPKeyServerKeySpace * outKeySpace); + +PGPError PGPGetKeyServerPort(PGPKeyServerRef inKeyServerRef, + PGPUInt16 * outPort); + +#undef PGPGetKeyServerHostName +PGPError PGPGetKeyServerHostName(PGPKeyServerRef inKeyServerRef, + PGPChar8 ** outHostName); /* Use PGPFreeData to free */ + +PGPError PGPGetKeyServerAddress(PGPKeyServerRef inKeyServerRef, + PGPUInt32 * outAddress); + +#undef PGPGetKeyServerPath +PGPError PGPGetKeyServerPath(PGPKeyServerRef inKeyServerRef, + PGPChar8 ** outPath); /* Use PGPFreeData to free */ + +PGPContextRef PGPGetKeyServerContext(PGPKeyServerRef inKeyServerRef); + +/* If there was an error string returned from the server, you can get it with + this function. Note that if there is no string, the function will return + kPGPError_NoErr and *outErrorString will be NULL */ +#undef PGPGetLastKeyServerErrorString +PGPError PGPGetLastKeyServerErrorString( + PGPKeyServerRef inKeyServerRef, + PGPChar8 ** outErrorString); /* Use PGPFreeData to free */ + + +/* These functions may be used with both HTTP and LDAP keyservers */ +PGPError PGPQueryKeyServer(PGPKeyServerRef inKeyServerRef, + PGPFilterRef inFilterRef, + PGPKeyDBRef *searchResultsDB); + +PGPError PGPUploadToKeyServer(PGPKeyServerRef inKeyServerRef, + PGPKeySetRef inKeysToUpload, + PGPKeySetRef * outKeysThatFailed); + + +/* These functions may only be used with LDAP keyservers */ +PGPError PGPDeleteFromKeyServer(PGPKeyServerRef inKeyServerRef, + PGPKeySetRef inKeysToDelete, + PGPKeySetRef * outKeysThatFailed); + +PGPError PGPDisableFromKeyServer(PGPKeyServerRef inKeyServerRef, + PGPKeySetRef inKeysToDisable, + PGPKeySetRef * outKeysThatFailed); + +PGPError PGPSendGroupsToServer(PGPKeyServerRef inKeyServerRef, + PGPGroupSetRef inGroupSetRef); + +PGPError PGPRetrieveGroupsFromServer( + PGPKeyServerRef inKeyServerRef, + PGPGroupSetRef * outGroupSetRef); + +PGPError PGPNewServerMonitor(PGPKeyServerRef inKeyServerRef, + PGPKeyServerMonitor ** outMonitor); + +PGPError PGPFreeServerMonitor(PGPKeyServerMonitor * inMonitor); + +/* X.509 Certificate Request functions */ + +PGPError PGPSendCertificateRequest( + PGPKeyServerRef inKeyServerRef, + PGPOptionListRef firstOption, + ... ); + +PGPError PGPRetrieveCertificate( + PGPKeyServerRef inKeyServerRef, + PGPOptionListRef firstOption, + ... ); + +PGPError PGPRetrieveCertificateRevocationList( + PGPKeyServerRef inKeyServerRef, + PGPOptionListRef firstOption, + ... ); +/* Queries HTTP proxy information. proxyAddress must be freed with PGPFreeData */ +#undef PGPGetProxyServer +PGPError PGPGetProxyServer( + PGPContextRef context, PGPProxyServerType type, + PGPChar8 **proxyAddress, PGPUInt16 *proxyPort ); + +PGP_END_C_DECLARATIONS + +#endif diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpKeys.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpKeys.h new file mode 100644 index 0000000000..8700cee34e --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpKeys.h @@ -0,0 +1,831 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpKeys.h,v 1.76 2004/05/19 00:09:07 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpKeys_h /* [ */ +#define Included_pgpKeys_h + +#include "pgpPubTypes.h" +#include "pgpHash.h" +#include "pgpOptionList.h" + +/* Key ordering */ + +enum PGPKeyOrdering_ +{ + kPGPKeyOrdering_Invalid = 0, + kPGPKeyOrdering_Any = 1, + kPGPKeyOrdering_UserID = 2, + kPGPKeyOrdering_KeyID = 3, + kPGPKeyOrdering_Validity = 4, + kPGPKeyOrdering_Trust = 5, + kPGPKeyOrdering_EncryptionKeySize = 6, + kPGPKeyOrdering_SigningKeySize = 7, + kPGPKeyOrdering_CreationDate = 8, + kPGPKeyOrdering_ExpirationDate = 9, + + PGP_ENUM_FORCE( PGPKeyOrdering_ ) +} ; +PGPENUM_TYPEDEF( PGPKeyOrdering_, PGPKeyOrdering ); + + +/* Key properties */ + +enum PGPKeyDBObjProperty_ +{ + kPGPKeyDBObjProperty_Invalid = 0, + + /* Generic numeric properties */ + kPGPKeyDBObjProperty_ObjectType = 20, + + /* Key boolean properties */ + kPGPKeyProperty_IsSecret = 100, + kPGPKeyProperty_IsAxiomatic = 101, + kPGPKeyProperty_IsRevoked = 102, + kPGPKeyProperty_IsDisabled = 103, + kPGPKeyProperty_IsNotCorrupt = 104, + kPGPKeyProperty_IsExpired = 105, + kPGPKeyProperty_NeedsPassphrase = 106, + kPGPKeyProperty_HasUnverifiedRevocation = 107, + kPGPKeyProperty_CanEncrypt = 108, + kPGPKeyProperty_CanDecrypt = 109, + kPGPKeyProperty_CanSign = 110, + kPGPKeyProperty_CanVerify = 111, + kPGPKeyProperty_IsEncryptionKey = 112, + kPGPKeyProperty_IsSigningKey = 113, + kPGPKeyProperty_IsSecretShared = 114, + kPGPKeyProperty_IsRevocable = 115, + kPGPKeyProperty_HasThirdPartyRevocation = 116, + kPGPKeyProperty_HasCRL = 117, + kPGPKeyProperty_IsOnToken = 118, + kPGPKeyProperty_IsStubKey = 119, /* used to filter dummy keys from inclusive key set */ + + /* Key numeric properties */ + kPGPKeyProperty_AlgorithmID = 200, + kPGPKeyProperty_Bits = 201, + kPGPKeyProperty_Trust = 202, + kPGPKeyProperty_Validity = 203, + kPGPKeyProperty_LockingAlgorithmID = 204, + kPGPKeyProperty_LockingBits = 205, + kPGPKeyProperty_Flags = 206, + kPGPKeyProperty_HashAlgorithmID = 207, + kPGPKeyProperty_Version = 208, + kPGPKeyProperty_KeyServerPreferences = 209, + kPGPKeyProperty_TokenNum = 210, + kPGPKeyProperty_Features = 211, + + /* Key time properties */ + kPGPKeyProperty_Creation = 300, + kPGPKeyProperty_Expiration = 301, + kPGPKeyProperty_CRLThisUpdate = 302, + kPGPKeyProperty_CRLNextUpdate = 303, + + /* Key data (variable sized) properties */ + kPGPKeyProperty_Fingerprint = 401, + kPGPKeyProperty_KeyID = 402, + kPGPKeyProperty_PreferredAlgorithms = 403, + kPGPKeyProperty_ThirdPartyRevocationKeyID = 404, + kPGPKeyProperty_KeyData = 405, + kPGPKeyProperty_X509MD5Hash = 406, + kPGPKeyProperty_PreferredKeyServer = 407, + kPGPKeyProperty_PreferredCompressionAlgorithms = 408, + + /* SubKey boolean properties */ + kPGPSubKeyProperty_IsRevoked = 501, + kPGPSubKeyProperty_IsNotCorrupt = 502, + kPGPSubKeyProperty_IsExpired = 503, + kPGPSubKeyProperty_NeedsPassphrase = 504, + kPGPSubKeyProperty_HasUnverifiedRevocation = 505, + kPGPSubKeyProperty_IsRevocable = 506, + kPGPSubKeyProperty_HasThirdPartyRevocation = 507, + kPGPSubKeyProperty_IsOnToken = 508, + + /* SubKey numeric properties */ + kPGPSubKeyProperty_AlgorithmID = 600, + kPGPSubKeyProperty_Bits = 601, + kPGPSubKeyProperty_LockingAlgorithmID = 602, + kPGPSubKeyProperty_LockingBits = 603, + kPGPSubKeyProperty_Version = 604, + kPGPSubKeyProperty_Flags = 605, + + /* SubKey time properties */ + kPGPSubKeyProperty_Creation = 700, + kPGPSubKeyProperty_Expiration = 701, + + /* SubKey data (variable sized) properties */ + kPGPSubKeyProperty_KeyData = 800, + kPGPSubKeyProperty_KeyID = 801, + + /* User ID boolean properties */ + kPGPUserIDProperty_IsAttribute = 900, + kPGPUserIDProperty_IsRevoked = 901, + + /* User ID numeric properties */ + kPGPUserIDProperty_Validity = 1000, + kPGPUserIDProperty_Confidence = 1001, + kPGPUserIDProperty_AttributeType = 1002, + + /* No User ID time properties */ + + /* User ID data (variable sized) properties */ + kPGPUserIDProperty_Name = 1200, + kPGPUserIDProperty_AttributeData = 1201, + kPGPUserIDProperty_CommonName = 1202, + kPGPUserIDProperty_EmailAddress = 1203, + kPGPUserIDProperty_SMIMEPreferredAlgorithms = 1204, + + /* Signature boolean properties */ + kPGPSigProperty_IsRevoked = 1300, + kPGPSigProperty_IsNotCorrupt = 1301, + kPGPSigProperty_IsTried = 1302, + kPGPSigProperty_IsVerified = 1303, + kPGPSigProperty_IsMySig = 1304, + kPGPSigProperty_IsExportable = 1305, + kPGPSigProperty_HasUnverifiedRevocation = 1306, + kPGPSigProperty_IsExpired = 1307, + kPGPSigProperty_IsX509 = 1308, + + /* Signature numeric properties */ + kPGPSigProperty_AlgorithmID = 1400, + kPGPSigProperty_TrustLevel = 1401, + kPGPSigProperty_TrustValue = 1402, + + /* Signature time properties */ + kPGPSigProperty_Creation = 1500, + kPGPSigProperty_Expiration = 1501, + + /* Signature data (variable sized) properties */ + kPGPSigProperty_KeyID = 1600, + kPGPSigProperty_X509Certificate = 1601, + kPGPSigProperty_X509IASN = 1602, + kPGPSigProperty_X509LongName = 1603, + kPGPSigProperty_X509IssuerLongName = 1604, + kPGPSigProperty_X509DNSName = 1605, + kPGPSigProperty_X509IPAddress = 1606, + kPGPSigProperty_X509DERDName = 1607, + kPGPSigProperty_RegularExpression = 1608, + + PGP_ENUM_FORCE( PGPKeyDBObjProperty_ ) +} ; +PGPENUM_TYPEDEF( PGPKeyDBObjProperty_, PGPKeyDBObjProperty ); + + +/* For kPGPKeyProperty_Version */ +enum PGPKeyVersion_ +{ + kPGPKeyVersion_V3 = 3, + kPGPKeyVersion_V4 = 4, + + PGP_ENUM_FORCE( PGPKeyVersion_ ) +} ; +PGPENUM_TYPEDEF( PGPKeyVersion_, PGPKeyVersion ); + + +/* kPGPKeyPropFlags bits */ + +enum /* PGPKeyPropertyFlags */ +{ + kPGPKeyPropertyFlags_UsageSignUserIDs = (1UL << 0 ), + kPGPKeyPropertyFlags_UsageSignMessages = (1UL << 1 ), + kPGPKeyPropertyFlags_UsageEncryptCommunications = (1UL << 2 ), + kPGPKeyPropertyFlags_UsageEncryptStorage = (1UL << 3 ), + + kPGPKeyPropertyFlags_PrivateSplit = (1UL << 4 ), + kPGPKeyPropertyFlags_PrivateShared = (1UL << 7 ) +} ; +typedef PGPFlags PGPKeyPropertyFlags; +#define kPGPKeyPropertyFlags_UsageSign \ + (kPGPKeyPropertyFlags_UsageSignUserIDs | \ + kPGPKeyPropertyFlags_UsageSignMessages) +#define kPGPKeyPropertyFlags_UsageEncrypt \ + (kPGPKeyPropertyFlags_UsageEncryptCommunications | \ + kPGPKeyPropertyFlags_UsageEncryptStorage) +#define kPGPKeyPropertyFlags_UsageSignEncrypt \ + (kPGPKeyPropertyFlags_UsageSign | \ + kPGPKeyPropertyFlags_UsageEncrypt) + +/* Attribute types, for use with kPGPUserIDPropAttributeType */ +enum PGPAttributeType_ +{ + kPGPAttribute_Image = 1, + kPGPAttribute_IPAddress = 10, + kPGPAttribute_DNSName = 11, + kPGPAttribute_Notation = 20, + + PGP_ENUM_FORCE( PGPAttributeType_ ) +} ; +PGPENUM_TYPEDEF( PGPAttributeType_, PGPAttributeType ); + +/* kPGPKeyPropFlags bits */ + +enum /* PGPKeyServerPreferencesFlags */ +{ + kPGPKeyServerPreferences_NoModify = (1UL << 7 ) +} ; +typedef PGPFlags PGPKeyServerPreferencesFlags; + +/* Implementation features like Modification Detection support */ + +enum +{ + kPGPKeyFeatures_ModificationDetection = 1 +} ; +typedef PGPFlags PGPKeyFeaturesFlags; + + +/* Key DB object types for the property kPGPKeyDBObjProperty_ObjectType */ +enum PGPKeyDBObjType_ +{ + kPGPKeyDBObjType_Invalid = 0, + kPGPKeyDBObjType_Key = (1UL << 0), + kPGPKeyDBObjType_SubKey = (1UL << 1), + kPGPKeyDBObjType_UserID = (1UL << 2), + kPGPKeyDBObjType_Signature = (1UL << 3), +#ifdef __MVS__ + kPGPKeyDBObjType_Any = -1, +#else + kPGPKeyDBObjType_Any = 0xFFFFFFFF, +#endif + + PGP_ENUM_FORCE( PGPKeyDBObjType_ ) +} ; +PGPENUM_TYPEDEF( PGPKeyDBObjType_, PGPKeyDBObjType ); + +/* + * Used by filtering functions to specify type of match. + */ + +enum PGPMatchCriterion_ +{ + kPGPMatchCriterion_Equal = 1, /* searched == val */ + kPGPMatchCriterion_GreaterOrEqual = 2, /* searched >= val */ + kPGPMatchCriterion_LessOrEqual = 3, /* searched <= val */ + kPGPMatchCriterion_SubString = 4, /* searched is contained in supplied */ + + PGP_ENUM_FORCE( PGPMatchCriterion_ ) +} ; +PGPENUM_TYPEDEF( PGPMatchCriterion_, PGPMatchCriterion ); + + +/* This is the value of the expiration time which means "never expires" */ +#define kPGPExpirationTime_Never ( (PGPTime)0 ) + +enum PGPOpenKeyDBFileOptions_ +{ + kPGPOpenKeyDBFileOptions_None = 0, + kPGPOpenKeyDBFileOptions_Mutable = (1UL << 0 ), + kPGPOpenKeyDBFileOptions_Create = (1UL << 1 ), + + PGP_ENUM_FORCE( PGPOpenKeyDBFileOptions_ ) +} ; + +PGPENUM_TYPEDEF( PGPOpenKeyDBFileOptions_, PGPOpenKeyDBFileOptions ); + +/* Public entry points */ + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + Key DB functions +____________________________________________________________________________*/ + +/* Creat a new, in-memory temporary key DB */ +PGPError PGPNewKeyDB( PGPContextRef context, PGPKeyDBRef *keyDBRef ); + +/* Open a (possibly) existing key ring pair on disk */ +PGPError PGPOpenKeyDBFile( PGPContextRef context, + PGPOpenKeyDBFileOptions options, + PGPFileSpecRef pubKeysFileSpec, + PGPFileSpecRef privKeysFileSpec, + PGPKeyDBRef *keyDBRef ); + +PGPError PGPFreeKeyDB( PGPKeyDBRef keyDBRef ); + +PGPError PGPFlushKeyDB( PGPKeyDBRef keyDBRef ); + +PGPError PGPIncKeyDBRefCount( PGPKeyDBRef keyDBRef ); + +PGPBoolean PGPKeyDBIsMutable( PGPKeyDBRef keyDBRef ); + +PGPError PGPFindKeyByKeyID( PGPKeyDBRef keyDBRef, const PGPKeyID * keyID, + PGPKeyDBObjRef *keyRef); + +PGPError PGPCountKeysInKeyDB( PGPKeyDBRef keyDBRef, PGPUInt32 *numKeys ); + +PGPError PGPKeyDBIsUpdated( PGPKeyDBRef keyDBRef, PGPBoolean *isUpdated ); + +/* Cache a keydb in memory for specified number of seconds */ +PGPError PGPCacheKeyDB( PGPKeyDBRef keyDBRef, PGPUInt32 timeoutSeconds ); + +/* Remove all cached keydbs from memory */ +PGPError PGPPurgeKeyDBCache( PGPContextRef context ); + +/*____________________________________________________________________________ + Key set functions +____________________________________________________________________________*/ + +/* Create a new key set containing all of the keys in the key DB */ +PGPError PGPNewKeySet( PGPKeyDBRef keyDB, PGPKeySetRef *keySet ); + +/* Create a new, empty key set */ +PGPError PGPNewEmptyKeySet( PGPKeyDBRef keyDB, PGPKeySetRef *keySet ); + +/* Create a new key set containing a single key */ +PGPError PGPNewOneKeySet( PGPKeyDBObjRef key, PGPKeySetRef *keySet ); + +/* Like PGPNewKeySet but allows certain stub key objects */ +PGPError PGPNewEmptyInclusiveKeySet( PGPKeyDBRef keyDB, PGPKeySetRef *pset ); + +/* Like PGPNewOneKeySet but allows certain stub key objects */ +PGPError PGPNewOneInclusiveKeySet( PGPKeyDBObjRef key, PGPKeySetRef *keySet ); + +PGPError PGPFreeKeySet( PGPKeySetRef keys); + +PGPError PGPIncKeySetRefCount( PGPKeySetRef keys); + +PGPBoolean PGPKeySetIsMember( PGPKeyDBObjRef key, PGPKeySetRef set ); + +PGPError PGPCountKeys( PGPKeySetRef keys, PGPUInt32 *numKeys ); + +PGPError PGPAddKey( PGPKeyDBObjRef keyToAdd, PGPKeySetRef set ); + +PGPError PGPAddKeys( PGPKeySetRef keysToAdd, PGPKeySetRef set ); + +PGPKeyDBRef PGPPeekKeySetKeyDB( PGPKeySetRef keySet ); +PGPKeySetRef PGPPeekKeyDBRootKeySet( PGPKeyDBRef keyDB ); + +/*____________________________________________________________________________ + Key DB object properties +____________________________________________________________________________*/ + +PGPError PGPGetKeyDBObjBooleanProperty( PGPKeyDBObjRef key, + PGPKeyDBObjProperty whichProperty, PGPBoolean *prop ); + +PGPError PGPGetKeyDBObjNumericProperty( PGPKeyDBObjRef key, + PGPKeyDBObjProperty whichProperty, PGPInt32 *prop ); + +PGPError PGPGetKeyDBObjTimeProperty( PGPKeyDBObjRef key, + PGPKeyDBObjProperty whichProperty, PGPTime *prop); +/* +** Get the data for a binary property. Returns kPGPError_BufferTooSmall if +** the buffer is too small. Both buffer and dataSize can be NULL. +*/ + +#undef PGPGetKeyDBObjDataProperty +PGPError PGPGetKeyDBObjDataProperty( PGPKeyDBObjRef key, + PGPKeyDBObjProperty whichProperty, void *buffer, + PGPSize bufferSize, PGPSize *dataSize); +/* +** Get the data for a binary property using an allocated output buffer. The +** allocated buffer must be freed with PGPFreeData(). For convenience, the +** allocated buffer is null-terminated. The terminating null byte is NOT included +** is the output dataSize parameter. +*/ + +PGPError PGPGetKeyDBObjAllocatedDataProperty( PGPKeyDBObjRef key, + PGPKeyDBObjProperty whichProperty, void **buffer, + PGPSize *dataSize); + +PGPError PGPSetKeyEnabled( PGPKeyDBObjRef key, PGPBoolean enable ); + +PGPError PGPSetKeyAxiomatic( PGPKeyDBObjRef key, PGPBoolean setAxiomatic, + PGPOptionListRef firstOption, ...); + +/*____________________________________________________________________________ + Key DB object property convenience functions +____________________________________________________________________________*/ + +/* Get the key ID of a key or subkey key DB object */ +PGPError PGPGetKeyID( PGPKeyDBObjRef key, PGPKeyID *keyID ); + +PGPError PGPGetPrimaryUserID( PGPKeyDBObjRef key, PGPKeyDBObjRef *outRef ); + +PGPError PGPGetPrimaryAttributeUserID (PGPKeyDBObjRef key, + PGPAttributeType attributeType, PGPKeyDBObjRef *outRef); + +PGPError PGPGetPrimaryUserIDValidity(PGPKeyDBObjRef key, + PGPValidity *validity); + +PGPError PGPGetPrimaryUserIDName(PGPKeyDBObjRef key, void *buffer, + PGPSize bufferSize, PGPSize *dataSize); + +PGPError PGPGetKeyForUsage( PGPKeyDBObjRef key, PGPUInt32 usageFlags, + PGPKeyDBObjRef *outRef ); + + + +/*____________________________________________________________________________ + Key filters +____________________________________________________________________________*/ + +PGPError PGPNewKeyDBObjBooleanFilter( PGPContextRef context, + PGPKeyDBObjProperty whichProperty, PGPBoolean match, + PGPFilterRef *outFilter ); + +PGPError PGPNewKeyDBObjNumericFilter( PGPContextRef context, + PGPKeyDBObjProperty whichProperty, PGPUInt32 matchValue, + PGPMatchCriterion matchCriteria, PGPFilterRef *outFilter ); + +PGPError PGPNewKeyDBObjTimeFilter( PGPContextRef context, + PGPKeyDBObjProperty whichProperty, PGPTime matchValue, + PGPMatchCriterion matchCriteria, PGPFilterRef *outFilter ); + +PGPError PGPNewKeyDBObjDataFilter( PGPContextRef context, + PGPKeyDBObjProperty whichProperty, const void *matchData, + PGPSize matchDataSize, PGPMatchCriterion matchCriteria, + PGPFilterRef *outFilter ); + +PGPError PGPFreeFilter( PGPFilterRef filter ); + +PGPError PGPIncFilterRefCount( PGPFilterRef filter ); + +PGPError PGPFilterChildObjects( PGPFilterRef filter, + PGPBoolean filterChildren ); + +/* freeing outfilter will call PGPFreeFilter on filter */ +PGPError PGPNegateFilter( PGPFilterRef filter, PGPFilterRef *outFilter); + +/* freeing outfilter will call PGPFreeFilter on filter1, filter2 */ +PGPError PGPIntersectFilters( PGPFilterRef filter1, PGPFilterRef filter2, + PGPFilterRef *outFilter); + +/* freeing outfilter will call PGPFreeFilter on filter1, filter2 */ +PGPError PGPUnionFilters( PGPFilterRef filter1, PGPFilterRef filter2, + PGPFilterRef *outFilter); + +PGPError PGPFilterKeySet( PGPKeySetRef origSet, PGPFilterRef filter, + PGPKeySetRef *resultSet ); + +PGPError PGPFilterKeyDB( PGPKeyDBRef keyDB, PGPFilterRef filter, + PGPKeySetRef *resultSet ); + +/* Keyserver filter functions */ +#undef PGPLDAPQueryFromFilter +PGPError PGPLDAPQueryFromFilter( PGPFilterRef filter, PGPChar8 **queryOut ); + +#undef PGPLDAPX509QueryFromFilter +PGPError PGPLDAPX509QueryFromFilter( PGPFilterRef filter, + PGPChar8 **queryOut ); + +#undef PGPHKSQueryFromFilter +PGPError PGPHKSQueryFromFilter( PGPFilterRef filter, PGPChar8 **queryOut ); + +#undef PGPNetToolsCAHTTPQueryFromFilter +PGPError PGPNetToolsCAHTTPQueryFromFilter( PGPFilterRef filter, + PGPChar8 **queryOut ); + +/*____________________________________________________________________________ + Key/signature validation +____________________________________________________________________________*/ + +PGPError PGPCalculateTrust( PGPKeySetRef keySet, PGPKeyDBRef optionalKeyDB); + +PGPError PGPCheckKeyRingSigs( PGPKeySetRef keysToCheck, + PGPKeyDBRef optionalSigningKeyDB, PGPBoolean checkAll, + PGPEventHandlerProcPtr eventHandler, + PGPUserValue eventHandlerData ); + +/*____________________________________________________________________________ + Key DB object creation/deletion +____________________________________________________________________________*/ + +PGPError PGPGenerateKey( PGPContextRef context, PGPKeyDBObjRef *key, + PGPOptionListRef firstOption, ...); + +PGPError PGPGenerateSubKey( PGPContextRef context, PGPKeyDBObjRef *subkey, + PGPOptionListRef firstOption, ...); + +PGPUInt32 PGPGetKeyEntropyNeeded( PGPContextRef context, + PGPOptionListRef firstOption, ...); + +#undef PGPAddUserID +PGPError PGPAddUserID( PGPKeyDBObjRef key, PGPChar8 const *userID, + PGPOptionListRef firstOption, ...); + +PGPError PGPAddAttributeUserID( PGPKeyDBObjRef key, + PGPAttributeType attributeType, + PGPByte *attributeData, PGPSize attributeLength, + PGPOptionListRef firstOption, ...); + +PGPError PGPCertifyUserID( PGPKeyDBObjRef userID, + PGPKeyDBObjRef certifyingKey, + PGPOptionListRef firstOption, ...); + +PGPError PGPCopyKeyDBObj( PGPKeyDBObjRef keyDBObj, PGPKeyDBRef destKeyDB, + PGPKeyDBObjRef *destKeyDBObj ); + +PGPError PGPCopyKeys( PGPKeySetRef keySet, PGPKeyDBRef destKeyDB, + PGPKeySetRef *destKeySet ); + +PGPError PGPDeleteKeyDBObj( PGPKeyDBObjRef keyDBObj ); + +PGPError PGPDeleteKeys( PGPKeySetRef keySet ); + +/*____________________________________________________________________________ + Key manipulation +____________________________________________________________________________*/ + +PGPError PGPSetPrimaryUserID( PGPKeyDBObjRef userID, + PGPOptionListRef firstOption, ...); + +PGPError PGPGetSigCertifierKey( PGPKeyDBObjRef cert, + PGPKeyDBRef searchKeyDB, PGPKeyDBObjRef *certkey); + +PGPError PGPGetSigX509CertifierSig( PGPKeyDBObjRef cert, + PGPKeyDBRef searchKeyDB, PGPKeyDBObjRef *certsig); + +PGPError PGPGetSigX509TopSig( PGPKeyDBObjRef sig, + PGPKeyDBRef otherdb, PGPKeyDBRef cadb, + PGPBoolean *knownCA, PGPKeyDBObjRef *certsig ); + +PGPError PGPGetKnownX509CAs( PGPContextRef context, PGPKeyDBRef *keydbout ); + +PGPError PGPX509MatchNetworkName( PGPKeyDBObjRef sig, const PGPByte *networkName, + PGPBoolean *matched ); + +PGPError PGPCountAdditionalRecipientRequests( PGPKeyDBObjRef basekey, + PGPUInt32 * numARKeys); + +PGPError PGPGetIndexedAdditionalRecipientRequestKey( PGPKeyDBObjRef basekey, + PGPUInt32 nth, PGPKeyDBObjRef *arkey, + PGPKeyID *arkeyid, PGPByte *arclass ); + +PGPError PGPGetAdditionalRecipientRequests( PGPKeyDBObjRef basekey, + PGPKeySetRef keySet ); + +PGPError PGPCountRevocationKeys( PGPKeyDBObjRef basekey, + PGPUInt32 * numRevKeys); + +PGPError PGPGetIndexedRevocationKey( PGPKeyDBObjRef basekey, PGPUInt32 nth, + PGPKeyDBObjRef *revkey, PGPKeyID *revkeyid ); + +PGPError PGPGetRevocationKeys( PGPKeyDBObjRef basekey, PGPKeySetRef keySet ); + +PGPError PGPGetCRLDistributionPoints( PGPKeyDBObjRef cakey, + PGPUInt32 *pnDistPoints, PGPByte **pDpoints, + PGPSize **pdpointLengths ); + +PGPError PGPGetCRLDistributionPointsPrintable( PGPKeyDBObjRef cakey, + PGPUInt32 *pnDistPoints, PGPByte **pDpoints ); + +PGPError PGPExport( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPImport( PGPContextRef context, PGPKeyDBRef *importedKeysDB, + PGPOptionListRef firstOption, ...); + +PGPError PGPRevokeSig( PGPKeyDBObjRef cert, + PGPOptionListRef firstOption, ...); + +PGPError PGPRevoke( PGPKeyDBObjRef key, + PGPOptionListRef firstOption, ...); + +PGPError PGPChangePassphrase( PGPKeyDBObjRef key, + PGPOptionListRef firstOption, ...); + +PGPBoolean PGPPassphraseIsValid( PGPKeyDBObjRef key, + PGPOptionListRef firstOption, ...); + +PGPError PGPPurgePassphraseCache( PGPContextRef context ); + +PGPError PGPCountCachedPassphrases( PGPContextRef context, + PGPUInt32 *pnLocal, PGPUInt32 *pnGlobal, + PGPUInt32 *pnOtherLocal ); + +PGPBoolean PGPTokenAuthIsValid( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +/* + * Trust values for PGPSetKeyTrust and kPGPKeyPropTrust property: + * + * kPGPKeyTrust_Undefined (do not pass to PGPSetKeyTrust) + * kPGPKeyTrust_Unknown (unknown) + * kPGPKeyTrust_Never (never) + * kPGPKeyTrust_Marginal (sometimes) + * kPGPKeyTrust_Complete (always) + * kPGPKeyTrust_Ultimate (do not pass to PGPSetKeyTrust) + */ + +PGPError PGPSetKeyTrust( PGPKeyDBObjRef key, PGPUInt32 trust); + +PGPInt32 PGPCompareKeys( PGPKeyDBObjRef a, PGPKeyDBObjRef b, + PGPKeyOrdering order ); + +#undef PGPCompareUserIDStrings +PGPInt32 PGPCompareUserIDStrings(PGPChar8 const *a, PGPChar8 const *b); + +/*____________________________________________________________________________ + Key lists +____________________________________________________________________________*/ + +PGPError PGPOrderKeySet( PGPKeySetRef src, PGPKeyOrdering order, + PGPBoolean reverseOrder, PGPKeyListRef *outRef ); + +PGPError PGPIncKeyListRefCount( PGPKeyListRef keys); + +PGPError PGPFreeKeyList( PGPKeyListRef keys ); + +/*____________________________________________________________________________ + Key list iteration +____________________________________________________________________________*/ + +PGPError PGPNewKeyIter( PGPKeyListRef keys, PGPKeyIterRef *outRef); + +PGPError PGPNewKeyIterFromKeySet( PGPKeySetRef keys, PGPKeyIterRef *outRef); + +PGPError PGPNewKeyIterFromKeyDB( PGPKeyDBRef keyDB, PGPKeyIterRef *outRef); + +PGPError PGPCopyKeyIter( PGPKeyIterRef orig, PGPKeyIterRef *outRef); + +PGPError PGPFreeKeyIter( PGPKeyIterRef iter); + +PGPInt32 PGPKeyIterIndex( PGPKeyIterRef iter); + +PGPError PGPKeyIterRewind( PGPKeyIterRef iter, PGPKeyDBObjType objectType); + +PGPInt32 PGPKeyIterSeek( PGPKeyIterRef iter, PGPKeyDBObjRef key); + +PGPError PGPKeyIterMove( PGPKeyIterRef iter, PGPInt32 relOffset, + PGPKeyDBObjRef *outRef); + +PGPError PGPKeyIterNextKeyDBObj( PGPKeyIterRef iter, + PGPKeyDBObjType objectType, PGPKeyDBObjRef *outRef); + +PGPError PGPKeyIterPrevKeyDBObj( PGPKeyIterRef iter, + PGPKeyDBObjType objectType, PGPKeyDBObjRef *outRef); + +PGPError PGPKeyIterGetKeyDBObj( PGPKeyIterRef iter, + PGPKeyDBObjType objectType, PGPKeyDBObjRef *outRef); + + +/*____________________________________________________________________________ + Get/set user value +____________________________________________________________________________*/ + +PGPError PGPSetKeyDBObjUserValue( PGPKeyDBObjRef key, + PGPUserValue userValue); + +PGPError PGPGetKeyDBObjUserValue( PGPKeyDBObjRef key, + PGPUserValue *userValue); + +/* Passphrase conversion to passkeybuffer */ +/* The size of the output buffer is from the kPGPKeyPropLockingBits property */ + +PGPError PGPGetPasskeyBuffer ( PGPKeyDBObjRef key, + void *passkeyBuffer, PGPOptionListRef firstOption,...); + +/* Change key options which are stored in self signatures internally */ + +PGPError PGPAddKeyOptions( PGPKeyDBObjRef key, + PGPOptionListRef firstOption, ...); + +PGPError PGPRemoveKeyOptions( PGPKeyDBObjRef key, + PGPOptionListRef firstOption, ...); + +PGPError PGPUpdateKeyOptions( PGPKeyDBObjRef key, + PGPOptionListRef firstOption, ...); + +/*____________________________________________________________________________ + Key IDs +____________________________________________________________________________*/ + +PGPError PGPNewKeyID( const PGPByte *keyIDBytes, PGPSize numKeyIDBytes, + PGPPublicKeyAlgorithm pkalg, PGPKeyID *id ); +#undef PGPNewKeyIDFromString +PGPError PGPNewKeyIDFromString( const PGPChar8 *string, + PGPPublicKeyAlgorithm pkalg, PGPKeyID *id ); +PGPError PGPGetKeyIDAlgorithm( const PGPKeyID *keyID, + PGPPublicKeyAlgorithm *pkalg ); + +enum PGPKeyIDStringType_ +{ + kPGPKeyIDString_Abbreviated = 1, + kPGPKeyIDString_Full = 2, + + PGP_ENUM_FORCE( PGPKeyIDStringType_ ) +}; +PGPENUM_TYPEDEF( PGPKeyIDStringType_, PGPKeyIDStringType ); + + +#define kPGPMaxKeyIDStringSize ( 127 + 1 ) +#undef PGPGetKeyIDString +PGPError PGPGetKeyIDString( PGPKeyID const * ref, PGPKeyIDStringType type, + PGPChar8 outString[ kPGPMaxKeyIDStringSize ] ); + +/* returns 0 if equal, -1 if key1 < key2, 1 if key1 > key2 */ +PGPInt32 PGPCompareKeyIDs( PGPKeyID const * key, PGPKeyID const * key2); + +/*____________________________________________________________________________ + Token functions +____________________________________________________________________________*/ + +PGPError PGPCountTokens( PGPContextRef context, PGPUInt32 *numTokens ); + +PGPError PGPDeleteKeyOnToken( PGPKeyDBObjRef key, + PGPUInt32 tokNumber /*-1 for any token*/, + const PGPByte *pin, PGPSize pinLen ); +PGPError PGPWipeToken( PGPContextRef context, PGPUInt32 tokNumber, + PGPByte const *passphrase, PGPSize passphraseLength ); +PGPError PGPFormatToken( PGPContextRef context, PGPUInt32 tokNumber, + PGPByte const * adminPin, PGPSize adminPinLen, + PGPByte const * newUserPin, PGPSize newUserPinLen ); +PGPError PGPTokenPassphraseIsValid( PGPContextRef context, + PGPUInt32 tokNumber, PGPByte const *passphrase, + PGPSize passphraseLength ); + +#undef PGPSetPKCS11DrvFile +PGPError PGPSetPKCS11DrvFile( PGPChar8 *module ); + +PGPError PGPSyncTokenKeys( PGPContextRef context, PGPUInt32 tokenNum, + PGPKeyDBRef destKeyDB, PGPBoolean *hadChanges ); + +PGPError PGPGetTokenInfoBooleanProperty( PGPContextRef context, + PGPUInt32 tokenNumber, PGPTokenProperty prop, + PGPBoolean *value ); +PGPError PGPGetTokenInfoNumericProperty( PGPContextRef context, + PGPUInt32 tokenNumber, PGPTokenProperty prop, + PGPUInt32 *value ); +#undef PGPGetTokenInfoDataProperty +PGPError PGPGetTokenInfoDataProperty( PGPContextRef context, + PGPUInt32 tokenNumber, PGPTokenProperty prop, + void *value, PGPSize size, PGPSize *sizeout ); + +/* Deprecated, use PGPGetTokenInfo*() */ +PGPError PGPGetTokenInfo( PGPContextRef context, + PGPUInt32 tokNumber, PGPTokenInfo *tokenInfo); + +/*____________________________________________________________________________ + Getting contexts back from key related items. +____________________________________________________________________________*/ + +PGPContextRef PGPPeekKeyDBContext( PGPKeyDBRef ref ); +PGPContextRef PGPPeekKeyDBObjContext( PGPKeyDBObjRef ref ); +PGPContextRef PGPPeekKeyListContext( PGPKeyListRef ref ); +PGPContextRef PGPPeekKeySetContext( PGPKeySetRef ref ); +PGPContextRef PGPPeekKeyIterContext( PGPKeyIterRef ref ); + +/*____________________________________________________________________________ + Getting parent objects from key related items. If the input is invalid, + you get kInvalidPGPKeyDBObjRef back. +____________________________________________________________________________*/ + +PGPKeyDBRef PGPPeekKeyDBObjKeyDB( PGPKeyDBObjRef ref ); +PGPKeyDBObjRef PGPPeekKeyDBObjKey( PGPKeyDBObjRef ref ); +PGPKeyDBObjRef PGPPeekKeyDBObjUserID( PGPKeyDBObjRef ref ); + +/*____________________________________________________________________________ + Secret sharing functionality +____________________________________________________________________________*/ + +PGPError PGPSecretShareData(PGPContextRef context, + void const * input, PGPSize inputBytes, + PGPUInt32 threshold, PGPUInt32 nShares, void * output); + +PGPError PGPSecretReconstructData(PGPContextRef context, + void * input, PGPSize outputBytes, + PGPUInt32 nShares, void * output); + +/*____________________________________________________________________________ + X509 certificate specific +____________________________________________________________________________*/ + +PGPError PGPVerifyX509CertificateChain (PGPContextRef context, + PGPByte *certchain, PGPByte *rootcerts); + +#undef PGPCreateDistinguishedName +PGPError PGPCreateDistinguishedName( PGPContextRef context, + PGPChar8 const *str, PGPByte **pdname, PGPSize *pdnamelen ); + +PGPError PGPCreateX509Certificate(PGPKeyDBObjRef signingSig, + PGPKeyDBObjRef signedKey, PGPKeyDBObjRef *newSig, + PGPOptionListRef firstOption, ...); + +/* Pass PKCS-10 format request in PGPOInput.... */ +PGPError PGPCreateX509CertificateFromRequest(PGPKeyDBObjRef signingSig, + PGPKeyDBObjRef *newSig, PGPOptionListRef firstOption, ...); + +PGPError PGPCreateSelfSignedX509Certificate(PGPKeyDBObjRef signingKey, + PGPKeyDBObjRef *newSig, PGPOptionListRef firstOption, ...); + +PGPError PGPCreateX509CRL(PGPKeyDBObjRef signingKey, + PGPKeySetRef revokedSigs, + PGPOptionListRef firstOption, ...); + + + +PGP_END_C_DECLARATIONS + + +#endif /* ] Included_pgpKeys_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpLDAP.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpLDAP.h new file mode 100644 index 0000000000..1cdce41630 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpLDAP.h @@ -0,0 +1,722 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpLDAP.h,v 1.24 2004/01/23 08:12:49 dallen Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpLDAP_h /* [ */ +#define Included_pgpLDAP_h + +#include "pgpBase.h" +#include "pgpPubTypes.h" +#include "pgpMemoryMgr.h" +#include "pgpSockets.h" +#include "pgpBER.h" + +PGP_BEGIN_C_DECLARATIONS + +/* LDAP parameters and constants */ +#define kPGPldap_DefaultPort 389 +#define kPGPldap_DefaultSecurePort 636 +#define kPGPldap_DefaultVersion 2 + +#define kPGPldapScopeString_Base PGPTXT_MACHINE8("base") +#define kPGPldapScopeString_OneLevel PGPTXT_MACHINE8("one") +#define kPGPldapScopeString_Subtree PGPTXT_MACHINE8("sub") + +#define kPGPldap_DefaultFilterString PGPTXT_MACHINE8("(objectclass=*)") + + + +/* Session options */ +#define kPGPldapOpt_Deref 1 +#define kPGPldapOpt_Sizelimit 2 +#define kPGPldapOpt_Timelimit 3 +#define kPGPldapOpt_Desc 4 + +#define kPGPldapOpt_ON ((void *) 1) +#define kPGPldapOpt_OFF ((void *) 0) + +enum PGPldapResult_ +{ + kPGPldapResult_Success = 0x00, + kPGPldapResult_OperationsError = 0x01, + kPGPldapResult_ProtocolError = 0x02, + kPGPldapResult_TimelimitExceeded = 0x03, + kPGPldapResult_SizelimitExceeded = 0x04, + kPGPldapResult_CompareFalse = 0x05, + kPGPldapResult_CompareTrue = 0x06, + kPGPldapResult_StrongAuthNotSupported = 0x07, + kPGPldapResult_StrongAuthRequired = 0x08, + kPGPldapResult_PartialResults = 0x09, + kPGPldapResult_NoSuchAttribute = 0x10, + kPGPldapResult_UndefinedType = 0x11, + kPGPldapResult_InappropriateMatching = 0x12, + kPGPldapResult_ConstraintViolation = 0x13, + kPGPldapResult_TypeOrValueExists = 0x14, + kPGPldapResult_InvalidSyntax = 0x15, + kPGPldapResult_NoSuchObject = 0x20, + kPGPldapResult_AliasProblem = 0x21, + kPGPldapResult_InvalidDNSyntax = 0x22, + kPGPldapResult_IsLeaf = 0x23, + kPGPldapResult_AliasDerefProblem = 0x24, + kPGPldapResult_InappropriateAuth = 0x30, + kPGPldapResult_InvalidCredentials = 0x31, + kPGPldapResult_InsufficientAccess = 0x32, + kPGPldapResult_Busy = 0x33, + kPGPldapResult_Unavailable = 0x34, + kPGPldapResult_UnwillingToPerform = 0x35, + kPGPldapResult_LoopDetect = 0x36, + kPGPldapResult_NamingViolation = 0x40, + kPGPldapResult_ObjectClassViolation = 0x41, + kPGPldapResult_NotAllowedOnNonleaf = 0x42, + kPGPldapResult_NotAllowedOnRDN = 0x43, + kPGPldapResult_AlreadyExists = 0x44, + kPGPldapResult_NoObjectClassMods = 0x45, + kPGPldapResult_ResultsTooLarge = 0x46, + kPGPldapResult_Other = 0x50, + kPGPldapResult_ServerDown = 0x51, + kPGPldapResult_LocalError = 0x52, + kPGPldapResult_EncodingError = 0x53, + kPGPldapResult_DecodingError = 0x54, + kPGPldapResult_Timeout = 0x55, + kPGPldapResult_AuthUnknown = 0x56, + kPGPldapResult_FilterError = 0x57, + kPGPldapResult_UserCancelled = 0x58, + kPGPldapResult_ParamError = 0x59, + kPGPldapResult_NoMemory = 0x5a, + kPGPldapResult_ConnectError = 0x5b, + + kPGPldapResult_None = 0xFFFFFFFF +}; +PGPENUM_TYPEDEF (PGPldapResult_, PGPldapResult); + +enum PGPldapType_ +{ + kPGPldapType_None = 0, + + kPGPldapRequest_Bind = 0x60, /* application + constructed */ + kPGPldapRequest_Unbind = 0x42, /* application + primitive */ + kPGPldapRequest_Search = 0x63, /* application + constructed */ + kPGPldapRequest_Modify = 0x66, /* application + constructed */ + kPGPldapRequest_Add = 0x68, /* application + constructed */ + kPGPldapRequest_Delete = 0x4A, /* application + primitive */ + kPGPldapRequest_ModifyRDN = 0x6C, /* application + constructed */ + kPGPldapRequest_Compare = 0x6E, /* application + constructed */ + kPGPldapRequest_Abandon = 0x50, /* application + primitive */ + + kPGPldapResponse_Bind = 0x61, /* application + constructed */ + kPGPldapResponse_SearchEntry = 0x64, /* application + constructed */ + kPGPldapResponse_SearchResult = 0x65, /* application + constructed */ + kPGPldapResponse_Modify = 0x67, /* application + constructed */ + kPGPldapResponse_Add = 0x69, /* application + constructed */ + kPGPldapResponse_Delete = 0x6B, /* application + constructed */ + kPGPldapResponse_ModifyRDN = 0x6D, /* application + constructed */ + kPGPldapResponse_Compare = 0x6F, /* application + constructed */ + + kPGPldapResponse_Any = 0xFFFFFFFF +}; +PGPENUM_TYPEDEF (PGPldapType_, PGPldapType); + +enum PGPldapScope_ +{ + kPGPldapScope_Base = 0, + kPGPldapScope_OneLevel = 1, + kPGPldapScope_Subtree = 2, + + kPGPldapScope_None = -1 +}; +PGPENUM_TYPEDEF (PGPldapScope_, PGPldapScope); + +enum PGPldapDeref_ +{ + kPGPldapDeref_Never = 0, + kPGPldapDeref_Searching = 1, + kPGPldapDeref_Finding = 2, + kPGPldapDeref_Always = 3 +}; +PGPENUM_TYPEDEF (PGPldapDeref_, PGPldapDeref); + +enum PGPldapAuth_ +{ + kPGPldapAuth_Simple = 0x80 /* context-specific + primitive, tag = 0 */ + /* Not implemented -- kPGPldapAuth_Kerb41 = 0x81, */ + /* Not implemented -- kPGPldapAuth_Kerb42 = 0x82 */ +}; +PGPENUM_TYPEDEF (PGPldapAuth_, PGPldapAuth); + +enum PGPldapFilter_ +{ + kPGPldapFilter_And = 0xA0, /* context specific + constructed, tag = 0 */ + kPGPldapFilter_Or = 0xA1, /* context specific + constructed, tag = 1 */ + kPGPldapFilter_Not = 0xA2, /* context specific + constructed, tag = 2 */ + kPGPldapFilter_Equal = 0xA3, /* context specific + constructed, tag = 3 */ + kPGPldapFilter_Substrings = 0xA4, /* context specific + constructed, tag = 4 */ + kPGPldapFilter_GE = 0xA5, /* context specific + constructed, tag = 5 */ + kPGPldapFilter_LE = 0xA6, /* context specific + constructed, tag = 6 */ + kPGPldapFilter_Present = 0x87, /* context specific + primitive, tag = 7 */ + kPGPldapFilter_Approx = 0xA8, /* context specific + constructed, tag = 8 */ + + kPGPldapFilter_None = (-1L) +}; +PGPENUM_TYPEDEF( PGPldapFilter_, PGPldapFilter ); + +enum PGPldapSubstring_ +{ + kPGPldapSubstring_Initial = 0x80, /* context specific + primitive, tag = 0 */ + kPGPldapSubstring_Any = 0x81, /* context specific + primitive, tag = 1 */ + kPGPldapSubstring_Final = 0x82, /* context specific + primitive, tag = 2 */ + + kPGPldapSubstring_None = (-1L) +}; +PGPENUM_TYPEDEF( PGPldapSubstring_, PGPldapSubstring ); + +enum PGPldapModOp_ +{ + kPGPldapModOp_Add = 0x00, + kPGPldapModOp_Delete = 0x01, + kPGPldapModOp_Replace = 0x02, + + kPGPldapModOp_None = (-1L) +}; +PGPENUM_TYPEDEF( PGPldapModOp_, PGPldapModOp ); + +#define kPGPldapModOpMask_UseBERValues 0x10 + + +/* LDAP Data types: typedefs, structs, and whatnot */ + +typedef PGPUInt32 PGPldapMessageID; + +#define kPGPldapMessageID_Any ( (PGPldapMessageID) -1 ) +#define kInvalidPGPldapMessageID ( (PGPldapMessageID) 0 ) +#define PGPldapMessageIDIsValid(messageID) \ + ( (messageID) != kInvalidPGPldapMessageID ) +#define PGPValidateLDAPMessageID(messageID) \ + PGPValidateParam( PGPldapMessageIDIsValid( messageID ) ) + +typedef struct PGPldapContext * PGPldapContextRef; + +#define kInvalidPGPldapContextRef ( (PGPldapContextRef) NULL ) +#define PGPldapContextRefIsValid(pgpLDAP) \ + ( (pgpLDAP) != kInvalidPGPldapContextRef ) +#define PGPValidateLDAPContextRef(context) \ + PGPValidateParam( PGPldapContextRefIsValid( context ) ) + +typedef struct PGPldapMessage * PGPldapMessageRef; + +#define kInvalidPGPldapMessageRef ( (PGPldapMessageRef) NULL) +#define PGPldapMessageRefIsValid(message) \ + ( (message) != kInvalidPGPldapMessageRef ) +#define PGPValidateLDAPMessageRef(message) \ + PGPValidateParam( PGPldapMessageRefIsValid( message ) ) + + +#define IsPGPldapError(err) \ + ( ( (err) >= kPGPError_LDAPMIN ) && ( (err) <= kPGPError_LDAPMAX ) ) + + +/* Callbacks for using LDAP functions in multithreaded apps */ +typedef struct PGPldapThreadFns +{ + void * (*pgpLDAPThread_MutexAlloc) (void); + void (*pgpLDAPThread_MutexFree) (void *); + PGPError (*pgpLDAPThread_MutexLock) (void *); + PGPError (*pgpLDAPThread_MutexUnlock) (void *); + void (*pgpLDAPThread_SetErrno) (int); + PGPError (*pgpLDAPThread_GetErrno) (void); + void (*pgpLDAPThread_SetLDAPErrno) (PGPInt32, PGPChar8 *, PGPChar8 *); + PGPInt32 (*pgpLDAPThread_GetLDAPErrno) (PGPChar8 **, PGPChar8 **); +} PGPldapThreadFns; + +typedef struct PGPldapMod +{ + PGPldapModOp op; + PGPChar8 * type; + + PGPChar8 ** value; + PGPberValue ** bvalue; +} PGPldapMod; + +typedef struct PGPldapURLDesc +{ + PGPChar8 * host; + PGPUInt16 port; + + PGPChar8 * dn; + PGPChar8 ** attrs; + + PGPldapScope scope; + PGPChar8 * filter; + +} PGPldapURLDesc; + +typedef PGPError (* PGPldapRebindProcPtr )( + PGPldapContextRef pgpLDAP, + PGPChar8 ** dnp, + PGPChar8 ** pwp, + PGPInt32 * method, + PGPBoolean freeIt, + PGPChar8 * arg ); + + +/* LDAP function prototypes */ +/* + * Above each function is the name of the analogous function + * in the UMich or Netscape LDAP SDK. While there are some subtle + * differences, for the most part, each function works basically + * the same as it's UMich/Netscape SDK counterpart. + */ + +/* Memory management functions */ + PGPError +PGPNewLDAPContext( + PGPContextRef context, + PGPldapContextRef *pgpLDAP ); + + PGPError +PGPNewLDAPMessage( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef * message ); + + PGPError +PGPFreeLDAPContext( + PGPldapContextRef pgpLDAP ); + + PGPError +PGPFreeLDAPMessage( + PGPldapMessageRef message ); + + /* ldap_value_free */ + PGPError +PGPFreeLDAPValues( + PGPChar8 ** vals ); + + /* ldap_value_free_len */ + PGPError +PGPFreeLDAPValuesLen( + PGPberValue ** bvals ); + + PGPError +PGPFreeLDAPURLDesc( + PGPldapURLDesc * lud ); + + +/* Result-handling functions */ + /* ldap_get_lderrno */ + PGPError +PGPldapGetErrno( + PGPldapContextRef pgpLDAP, + PGPChar8 ** matched, + PGPChar8 ** message, + PGPldapResult * result ); + + PGPError +PGPldapResultToError( + PGPldapContextRef pgpLDAP, + PGPldapResult result ); + +/* LDAP option functions */ + /* ldap_set_option */ + PGPError +PGPldapSetOption( + PGPldapContextRef pgpLDAP, + PGPUInt32 option, + void * value ); + + /* ldap_get_option */ + PGPError +PGPldapGetOption( + PGPldapContextRef pgpLDAP, + PGPUInt32 option, + void * value ); + + +/* Connection starting and stopping functions */ + /* ldap_open */ + PGPError +PGPldapOpen( + PGPldapContextRef pgpLDAP, + PGPChar8 * host, + PGPUInt16 port ); + + PGPError +PGPldapOpenTimeout( + PGPldapContextRef pgpLDAP, + PGPChar8 * host, + PGPUInt16 port, + PGPSocketsTimeValue *tv ); + + /* ldap_simple_bind_s */ + PGPError +PGPldapSimpleBindSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * password ); + + /* ldap_simple_bind_st (extension) */ + PGPError +PGPldapSimpleBindSyncTimeout( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * password, + PGPSocketsTimeValue *tv); + + /* ldap_simple_bind */ + PGPError +PGPldapSimpleBind( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * password, + PGPldapMessageID * messageID ); + + /* ldap_bind_s */ + PGPError +PGPldapBindSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * password, + PGPldapAuth method ); + + /* ldap_bind */ + PGPError +PGPldapBind( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * password, + PGPldapAuth method, + PGPldapMessageID * messageID ); + + /* ldap_unbind */ + PGPError +PGPldapUnbind( + PGPldapContextRef pgpLDAP ); + + +/* Searching functions */ + /* ldap_search_s */ + PGPError +PGPldapSearchSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * base, + PGPldapScope scope, + PGPChar8 * filter, + PGPChar8 * attrs[], + PGPBoolean attrsOnly, + PGPldapMessageRef resultMessage ); + + /* ldap_search_st */ + PGPError +PGPldapSearchSyncTimeout( + PGPldapContextRef pgpLDAP, + PGPChar8 * base, + PGPldapScope scope, + PGPChar8 * filter, + PGPChar8 * attrs[], + PGPBoolean attrsOnly, + PGPSocketsTimeValue * tv, + PGPldapMessageRef resultMessage ); + + /* ldap_search */ + PGPError +PGPldapSearch( + PGPldapContextRef pgpLDAP, + PGPChar8 * base, + PGPldapScope scope, + PGPChar8 * filter, + PGPChar8 * attrs[], + PGPBoolean attrsOnly, + PGPldapMessageID * messageID ); + + /* ldap_count_entries */ + PGPError +PGPldapCountEntries( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef result, + PGPInt32 * num ); + + /* ldap_first_entry */ + PGPError +PGPldapFirstEntry( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef result, + PGPldapMessageRef * outMessage ); + + /* ldap_next_entry */ + PGPError +PGPldapNextEntry( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef prevEntry, + PGPldapMessageRef * outMessage ); + + /* ldap_get_dn */ + PGPError +PGPldapGetDN( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef entry, + PGPChar8 ** dn ); /* Should be freed by PGPFreeData */ + + /* ldap_first_attribute */ + PGPError +PGPldapFirstAttribute( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef entry, + PGPberElementRef * ber, + PGPChar8 ** attr ); /* Should be freed by PGPFreeData */ + + /* ldap_next_attribute */ + PGPError +PGPldapNextAttribute( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef entry, + PGPberElementRef ber, + PGPChar8 ** attr ); /* Should be freed by PGPFreeData */ + + /* ldap_get_values */ + PGPError +PGPldapGetValues( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef entry, + PGPChar8 * attr, + PGPChar8 *** values ); /* Should be freed by PGPFreeLDAPValues */ + + /* ldap_get_values_len */ + PGPError +PGPldapGetValuesLen( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef entry, + PGPChar8 * attr, + PGPberValue *** values ); /* Should be freed by PGPFreeLDAPValuesLen */ + + /* ldap_count_values */ + PGPError +PGPldapCountValues( + PGPldapContextRef pgpLDAP, + PGPChar8 ** values, + PGPSize * num ); + + /* ldap_count_values_len */ + PGPError +PGPldapCountValuesLen( + PGPldapContextRef pgpLDAP, + PGPberValue ** values, + PGPSize * num ); + + +/* Update functions */ + + /* ldap_modify */ + PGPError +PGPldapModify( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPldapMod * mod[], + PGPldapMessageID * messageID ); + + /* ldap_modify_s */ + PGPError +PGPldapModifySync( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPldapMod * mod[] ); + + /* ldap_modify_st (extension) */ + PGPError +PGPldapModifySyncTimeout( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPldapMod * mod[], + PGPSocketsTimeValue *tv); + + /* ldap_add */ + PGPError +PGPldapAdd( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPldapMod * mod[], + PGPldapMessageID * messageID ); + + /* ldap_add_s */ + PGPError +PGPldapAddSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPldapMod * mod[] ); + + /* ldap_add_st (extension) */ + PGPError +PGPldapAddSyncTimeout( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPldapMod * mod[], + PGPSocketsTimeValue *tv ); + + /* ldap_delete */ + PGPError +PGPldapDelete( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPldapMessageID * messageID ); + + /* ldap_delete_s */ + PGPError +PGPldapDeleteSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn ); + + /* ldap_delete_st (extension) */ + PGPError +PGPldapDeleteSyncTimeout( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPSocketsTimeValue *tv); + + /* ldap_modrdn2 */ + PGPError +PGPldapModifyRDN( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * newRDN, + PGPBoolean deleteOldRDN, + PGPldapMessageID * messageID ); + + /* ldap_modrdn2_s */ + PGPError +PGPldapModifyRDNSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * newRDN, + PGPBoolean deleteOldRDN ); + + /* ldap_compare */ + PGPError +PGPldapCompare( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * type, + PGPChar8 * value, + PGPldapMessageID * messageID ); + + /* ldap_compare_s */ + PGPError +PGPldapCompareSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPChar8 * type, + PGPChar8 * value, + PGPBoolean * equal ); + + PGPError +PGPldapGetCompareResult( + PGPldapContextRef pgpLDAP, + PGPldapMessageID messageID, + PGPBoolean * equal ); + + +/* Other functions */ + /* ldap_result */ + PGPError +PGPldapGetResult( + PGPldapContextRef pgpLDAP, + PGPldapMessageID messageID, + PGPBoolean all, + PGPSocketsTimeValue * timeout, + PGPldapMessageRef result, + PGPldapType * messageType ); + + /* ldap_abandon */ + PGPError +PGPldapAbandon( + PGPldapContextRef pgpLDAP, + PGPldapMessageID messageID ); + + /* ldap_msgid */ + PGPError +PGPldapGetMessageID( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef result, + PGPldapMessageID * messageID ); + + /* ldap_is_ldap_url */ + PGPError +PGPldapIsLDAPURL( + PGPldapContextRef pgpLDAP, + PGPChar8 * url, + PGPBoolean * isURL ); + + /* ldap_url_parse */ + PGPError +PGPldapURLParse( + PGPldapContextRef pgpLDAP, + PGPChar8 * url, + PGPldapURLDesc ** outLDAPDesc ); /* Should be freed by PGPFreeLDAPURLDesc */ + + /* ldap_url_search */ + PGPError +PGPldapURLSearch( + PGPldapContextRef pgpLDAP, + PGPChar8 * url, + PGPBoolean attrsOnly, + PGPldapMessageID * messageID ); + + /* ldap_url_search */ + PGPError +PGPldapURLSearchSync( + PGPldapContextRef pgpLDAP, + PGPChar8 * url, + PGPBoolean attrsOnly, + PGPldapMessageRef resultMessage ); + + /* ldap_url_search */ + PGPError +PGPldapURLSearchSyncTimeout( + PGPldapContextRef pgpLDAP, + PGPChar8 * url, + PGPBoolean attrsOnly, + PGPSocketsTimeValue * tv, + PGPldapMessageRef resultMessage ); + + /* ldap_explode_dn */ + PGPError +PGPldapExplodeDN( + PGPldapContextRef pgpLDAP, + PGPChar8 * dn, + PGPBoolean noTypes, + PGPChar8 *** components ); /* Should be freed by PGPFreeLDAPValues */ + + /* ldap_sort_entries */ + PGPError +PGPldapSortEntries( + PGPldapContextRef pgpLDAP, + PGPldapMessageRef chain, + PGPChar8 * attr, + PGPInt32 (*compare)( PGPChar8 ** a, PGPChar8 ** b ), + PGPldapMessageRef sortedChain ); + + /* ldap_sort_values */ + PGPError +PGPldapSortValues( + PGPldapContextRef pgpLDAP, + PGPChar8 ** vals, + PGPInt32 (*compare)( PGPChar8 ** a, PGPChar8 ** b ), + PGPChar8 *** sortedVals ); + + /* ldap_sort_strcasecmp */ + PGPInt32 +PGPldapCompareStringsIgnoreCase( + PGPChar8 ** s1, + PGPChar8 ** s2 ); + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpLDAP_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpMemoryMgr.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpMemoryMgr.h new file mode 100644 index 0000000000..1a86a22a46 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpMemoryMgr.h @@ -0,0 +1,220 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpMemoryMgr.h,v 1.9 2003/11/08 04:04:49 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpMemoryMgr_h /* [ */ +#define Included_pgpMemoryMgr_h + +#include "pgpBase.h" + +/*____________________________________________________________________________ + Mini-tutorial: + + A PGPMemoryMgr is an object which implements memory management, including + allocation, reallocation, deallocation, and secure versions of the same. + + *** Using it *** + A typical sequence of calls is as follows: + PGPNewMemoryMgr + ... + PGPNewData or PGPNewSecureData + PGPFreeData + ... + PGPFreeMemoryMgr + + Typically, a program will create one PGPMemoryMgr per thread at + thread creation time and use that memory mgr until the thread dies. + Generally, an individual PGPMemoryMgr instance is not thread-safe; + you must either synchronize or use one PGPMemoryMgr per thread. + + + *** Custom Allocators *** + + Default allocators are supplied, but the client can create a custom + PGPMemoryMgr using PGPNewMemoryMgrCustom() which uses client-supplied + routines. + Custom routines need only concern themselves with the actual + allocation and deallocation. + The following should be kept in mind for user supplied routines: + - they can ignore the allocation flags passed + - leaks, memory clearing, etc is done by the PGPMemoryMgr + - secure allocator must set 'isNonPageable' to TRUE only if the + memory really can't be paged. + - the user value is not interpreted by the PGPMemoryMgr. Typically, + it would be a pointer to some data the allocation routines use + to store state. + + + *** Secure memory allocation *** + + Blocks can be allocated as "Secure" blocks. Secure blocks are guaranteed + to be wiped when they are deallocated. Additionally, if the operating + system and the current conditions allow, the block will be allocated + in non-pageable memory. You can determine the attributes of a block using + PGPGetMemoryMgrDataInfo(). + + + *** Leaks tracking *** + + Leaks tracking is implemented when debugging is on, + but currently reporting is limited to reporting the number of leaks + outstanding when the PGPMemoryMgr is disposed. + + + *** Debugging *** + + For debugging purposes, blocks may be larger in debug mode to accomodate + various schemes to detect stray pointers, etc. +____________________________________________________________________________*/ + +#if PGP_MACINTOSH +#pragma options align=mac68k +#endif + +enum +{ + kPGPMemoryMgrFlags_None = 0, + kPGPMemoryMgrFlags_Clear = 1 +}; + +typedef PGPFlags PGPMemoryMgrFlags; + +typedef struct PGPMemoryMgr * PGPMemoryMgrRef; + +#define kInvalidPGPMemoryMgrRef ((PGPMemoryMgrRef) NULL) +#define PGPMemoryMgrRefIsValid(ref) ((ref) != kInvalidPGPMemoryMgrRef) + +typedef void *(*PGPMemoryMgrAllocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + PGPSize requestSize, PGPMemoryMgrFlags flags ); + +/* realloc not be implemented using PGPNewData() */ +typedef PGPError (*PGPMemoryMgrReallocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + void **allocation, PGPSize newAllocationSize, + PGPMemoryMgrFlags flags, PGPSize existingSize ); + +typedef PGPError (*PGPMemoryMgrDeallocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + void *allocation, PGPSize allocationSize ); + + +typedef void *(*PGPMemoryMgrSecureAllocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + PGPSize requestSize, PGPMemoryMgrFlags flags, + PGPBoolean *isNonPageable ); + + +/* deallocation proc need not clear the memory upon deallocation since + PGPFreeData() does it automatically */ +typedef PGPError (*PGPMemoryMgrSecureDeallocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + void *allocation, PGPSize allocationSize, + PGPBoolean wasLocked ); + +typedef struct PGPNewMemoryMgrStruct +{ + /* sizeofStruct must be inited to sizeof( PGPNewMemoryMgrStruct ) */ + PGPUInt32 sizeofStruct; + PGPFlags reservedFlags; + + PGPMemoryMgrAllocationProc allocProc; + PGPMemoryMgrReallocationProc reallocProc; + PGPMemoryMgrDeallocationProc deallocProc; + + PGPMemoryMgrSecureAllocationProc secureAllocProc; + void * reserved; /* MUST be zeroed */ + PGPMemoryMgrSecureDeallocationProc secureDeallocProc; + + PGPUserValue customValue; + void * pad[ 8 ]; /* MUST be zeroed */ +} PGPNewMemoryMgrStruct; + +PGP_BEGIN_C_DECLARATIONS + + +/*____________________________________________________________________________ + Memory Mgr routines +____________________________________________________________________________*/ + +PGPError PGPNewMemoryMgr( PGPFlags reserved, PGPMemoryMgrRef *newMemoryMgr ); + +PGPError PGPNewMemoryMgrCustom( PGPNewMemoryMgrStruct const * custom, + PGPMemoryMgrRef *newMemoryMgr ); + +PGPError PGPFreeMemoryMgr( PGPMemoryMgrRef mgr ); + +PGPError PGPGetMemoryMgrCustomValue( PGPMemoryMgrRef mgr, + PGPUserValue *customValue ); +PGPError PGPSetMemoryMgrCustomValue( PGPMemoryMgrRef mgr, + PGPUserValue customValue ); + +PGPError PGPValidateMemoryMgr( PGPMemoryMgrRef mgr ); + +/* allocate a block of the specified size */ +void * PGPNewData( PGPMemoryMgrRef mgr, + PGPSize requestSize, PGPMemoryMgrFlags flags ); + +/* allocate a block of the specified size in non-pageable memory */ +/* *isSecure is TRUE if the block definitely can't be paged */ +void * PGPNewSecureData( PGPMemoryMgrRef mgr, + PGPSize requestSize, PGPMemoryMgrFlags flags ); + +/* properly reallocs secure or non-secure blocks */ +/* WARNING: the block may move, even if its size is being reduced */ +PGPError PGPReallocData( PGPMemoryMgrRef mgr, + void **allocation, PGPSize newAllocationSize, + PGPMemoryMgrFlags flags ); + +/* properly frees secure or non-secure blocks */ +PGPError PGPFreeData( void *allocation ); + + +/*____________________________________________________________________________ + Block Info: + kPGPMemoryMgrBlockInfo_Valid it's a valid block + kPGPMemoryMgrBlockInfo_Secure block is a secure allocation + kPGPMemoryMgrBlockInfo_NonPageable block cannot be paged by VM + + Secure blocks are always wiped before being disposed, + but may or may not be pageable, depending on the OS facilities. Some + OSs may not provide the ability to make blocks non-pageable. + + You should check these flags if the information matters to you. +____________________________________________________________________________*/ +#define kPGPMemoryMgrBlockInfo_Valid ( ((PGPFlags)1) << 0 ) +#define kPGPMemoryMgrBlockInfo_Secure ( ((PGPFlags)1) << 1 ) +#define kPGPMemoryMgrBlockInfo_NonPageable ( ((PGPFlags)1) << 2 ) +PGPFlags PGPGetMemoryMgrDataInfo( void *allocation ); + + +/*____________________________________________________________________________ + Default memory manager routines: +____________________________________________________________________________*/ + +PGPMemoryMgrRef PGPGetDefaultMemoryMgr(void); +PGPError PGPSetDefaultMemoryMgr(PGPMemoryMgrRef memoryMgr); + + +PGP_END_C_DECLARATIONS + + + +#if PGP_MACINTOSH +#pragma options align=reset +#endif + + +#endif /* ] Included_pgpMemoryMgr_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpOptionList.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpOptionList.h new file mode 100644 index 0000000000..a0ef6ceab6 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpOptionList.h @@ -0,0 +1,542 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + This file contains the types and prototypes for functions which manipulate + PGPOptionList data structures. + + $Id: pgpOptionList.h,v 1.43 2004/05/15 02:48:39 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpOptionList_h /* [ */ +#define Included_pgpOptionList_h + +#include <stdarg.h> + +#include "pgpPubTypes.h" + +#if PGP_MACINTOSH +#include <Files.h> +#elif PGP_OSX + struct FSSpec; +#endif + +/* Standard event callback declaration */ +struct PGPEvent; +typedef PGPError (*PGPEventHandlerProcPtr)(PGPContextRef context, + struct PGPEvent *event, PGPUserValue userValue); + +/* Export formats for exporting functions */ +enum PGPExportFormat_ +{ + kPGPExportFormat_Basic = 1, + kPGPExportFormat_Complete = 255, + + kPGPExportFormat_TokenKeyContainer = 256, + + kPGPExportFormat_X509Cert = 10000, + kPGPExportFormat_PKCS8, + + kPGPExportFormat_X509CertReq = 11000, + kPGPExportFormat_NetToolsCAV1_CertReq, + kPGPExportFormat_VerisignV1_CertReq, + kPGPExportFormat_EntrustV1_CertReq, + kPGPExportFormat_NetscapeV1_CertReq, + kPGPExportFormat_MicrosoftV1_CertReq, + + kPGPExportFormat_X509GetCertInitial = 11010, + kPGPExportFormat_NetToolsCAV1_GetCertInitial, + kPGPExportFormat_VerisignV1_GetCertInitial, + kPGPExportFormat_EntrustV1_GetCertInitial, + kPGPExportFormat_NetscapeV1_GetCertInitial, + kPGPExportFormat_MicrosoftV1_GetCertInitial, + + kPGPExportFormat_X509GetCRL = 11020, + kPGPExportFormat_NetToolsCAV1_GetCRL, + kPGPExportFormat_VerisignV1_GetCRL, + kPGPExportFormat_EntrustV1_GetCRL, + kPGPExportFormat_NetscapeV1_GetCRL, + kPGPExportFormat_MicrosoftV1_GetCRL, + + PGP_ENUM_FORCE( PGPExportFormat_ ) +}; +PGPENUM_TYPEDEF( PGPExportFormat_, PGPExportFormat ); + +/* Input formats for PGPOInputFormat */ +enum PGPInputFormat_ +{ + kPGPInputFormat_Unknown = 0, + kPGPInputFormat_PGP = 1, + + kPGPInputFormat_X509DataInPKCS7 = 10000, + kPGPInputFormat_NetToolsCAV1_DataInPKCS7, + kPGPInputFormat_VerisignV1_DataInPKCS7, + kPGPInputFormat_EntrustV1_DataInPKCS7, + kPGPInputFormat_MicrosoftV1_DataInPKCS7, + kPGPInputFormat_NetscapeV1_DataInPKCS7, + + kPGPInputFormat_PEMEncodedX509Cert, + kPGPInputFormat_NetToolsCAV1_PEMEncoded, + kPGPInputFormat_VerisignV1_PEMEncoded, + kPGPInputFormat_EntrustV1_PEMEncoded, + kPGPInputFormat_MicrosoftV1_PEMEncoded, + kPGPInputFormat_NetscapeV1_PEMEncoded, + + /* Input formats for X.509 private keys */ + kPGPInputFormat_PrivateKeyInfo, + kPGPInputFormat_PKCS12, + + kPGPInputFormat_SMIMEBody = 12000, + kPGPInputFormat_SMIMEBodySignedData = 12001, + kPGPInputFormat_SMIMEBodyEncryptedData = 12002, + + PGP_ENUM_FORCE( PGPInputFormat_ ) +}; +PGPENUM_TYPEDEF( PGPInputFormat_, PGPInputFormat ); + +/* Output formats for PGPOOutputFormat */ +enum PGPOutputFormat_ +{ + kPGPOutputFormat_Unknown = 0, + kPGPOutputFormat_PGP = 1, + + kPGPOutputFormat_X509CertReqInPKCS7 = 10000, + kPGPOutputFormat_NetToolsCAV1_CertReqInPKCS7, + kPGPOutputFormat_VerisignV1_CertReqInPKCS7, + kPGPOutputFormat_EntrustV1_CertReqInPKCS7, + kPGPOutputFormat_NetscapeV1_CertReqInPKCS7, + kPGPOutputFormat_MicrosoftV1_CertReqInPKCS7, + + kPGPOutputFormat_X509GetCertInitialInPKCS7 = 10010, + kPGPOutputFormat_NetToolsCAV1_GetCertInitialInPKCS7, + kPGPOutputFormat_VerisignV1_GetCertInitialInPKCS7, + kPGPOutputFormat_EntrustV1_GetCertInitialInPKCS7, + kPGPOutputFormat_NetscapeV1_GetCertInitialInPKCS7, + kPGPOutputFormat_MicrosoftV1_GetCertInitialInPKCS7, + + kPGPOutputFormat_X509GetCRLInPKCS7 = 10020, + kPGPOutputFormat_NetToolsCAV1_GetCRLInPKCS7, + kPGPOutputFormat_VerisignV1_GetCRLInPKCS7, + kPGPOutputFormat_EntrustV1_GetCRLInPKCS7, + kPGPOutputFormat_NetscapeV1_GetCRLInPKCS7, + kPGPOutputFormat_MicrosoftV1_GetCRLInPKCS7, + + kPGPOutputFormat_SMIMEBodySignedData = 12001, + kPGPOutputFormat_SMIMEBodyEncryptedData = 12002, + + PGP_ENUM_FORCE( PGPOutputFormat_ ) +}; +PGPENUM_TYPEDEF( PGPOutputFormat_, PGPOutputFormat ); + +/* Attribute-Value structure for PGPOAttributeValue */ +enum PGPAVAttribute_ +{ + /* Pointer properties */ + kPGPAVAttributeFirstPointer = 0, + kPGPAVAttribute_CommonName = kPGPAVAttributeFirstPointer, + kPGPAVAttribute_Email, + kPGPAVAttribute_OrganizationName, + kPGPAVAttribute_OrganizationalUnitName, + kPGPAVAttribute_SurName, + kPGPAVAttribute_SerialNumber, + kPGPAVAttribute_Country, + kPGPAVAttribute_Locality, + kPGPAVAttribute_State, + kPGPAVAttribute_StreetAddress, + kPGPAVAttribute_Title, + kPGPAVAttribute_Description, + kPGPAVAttribute_PostalCode, + kPGPAVAttribute_POBOX, + kPGPAVAttribute_PhysicalDeliveryOfficeName, + kPGPAVAttribute_TelephoneNumber, + kPGPAVAttribute_X121Address, + kPGPAVAttribute_ISDN, + kPGPAVAttribute_DestinationIndicator, + kPGPAVAttribute_Name, + kPGPAVAttribute_GivenName, + kPGPAVAttribute_Initials, + kPGPAVAttribute_HouseIdentifier, + kPGPAVAttribute_DirectoryManagementDomain, + kPGPAVAttribute_DomainComponent, + kPGPAVAttribute_UnstructuredName, + kPGPAVAttribute_UnstructuredAddress, + kPGPAVAttribute_RFC822Name, + kPGPAVAttribute_DNSName, + kPGPAVAttribute_AnotherName, + kPGPAVAttribute_IPAddress, + kPGPAVAttribute_CertificateExtension, + kPGPAVAttribute_SCEPChallenge, + + /* Verisign specific */ + kPGPAVAttribute_Challenge, + kPGPAVAttribute_CertType, + kPGPAVAttribute_MailFirstName, + kPGPAVAttribute_MailMiddleName, + kPGPAVAttribute_MailLastName, + kPGPAVAttribute_EmployeeID, + kPGPAVAttribute_MailStop, + kPGPAVAttribute_AdditionalField4, + kPGPAVAttribute_AdditionalField5, + kPGPAVAttribute_AdditionalField6, + kPGPAVAttribute_Authenticate, + + /* Generic pointer properties continue */ + kPGPAVAttribute_KeyID = kPGPAVAttribute_Authenticate+100, + + kPGPAVAttributeLastPointer = kPGPAVAttribute_KeyID, + + /* Boolean properties */ + kPGPAVAttributeFirstBoolean = 1000, + + /* Verisign specific */ + kPGPAVAttribute_EmbedEmail, + + + /* Numeric (PGPUInt32) properties */ + kPGPAVAttributeFirstNumber = 2000, + + PGP_ENUM_FORCE( PGPAVAttribute_ ) +} ; +PGPENUM_TYPEDEF( PGPAVAttribute_, PGPAVAttribute ); + +typedef struct PGPAttributeValue +{ + PGPAVAttribute attribute; + PGPUInt32 size; + union + { + PGPBoolean booleanvalue; + PGPUInt32 longvalue; + void *pointervalue; + + } value; + + PGPUInt32 unused; +} PGPAttributeValue ; + +enum PGPSMIMEMatchCriterion_ +{ + kPGPSMIMEMatchCriterion_Exact = 1, /* exact matching per SMIME spec (default) */ + kPGPSMIMEMatchCriterion_Related = 2, /* use Issuer from IASN, use Exact first then Any for keyIdentifier */ + kPGPSMIMEMatchCriterion_Any = 3, /* try all */ + + PGP_ENUM_FORCE( PGPSMIMEMatchCriterion_ ) +} ; +PGPENUM_TYPEDEF( PGPSMIMEMatchCriterion_, PGPSMIMEMatchCriterion ); + +PGP_BEGIN_C_DECLARATIONS + + +PGPError PGPNewOptionList( PGPContextRef context, PGPOptionListRef *outList ); +PGPError PGPAppendOptionList( PGPOptionListRef optionList, + PGPOptionListRef firstOption, ... ); +PGPError PGPBuildOptionList( PGPContextRef context, + PGPOptionListRef *outList, + PGPOptionListRef firstOption, ... ); +PGPError PGPCopyOptionList( PGPOptionListRef optionList, + PGPOptionListRef *outList ); +PGPError PGPFreeOptionList( PGPOptionListRef optionList ); + +/* +** The following functions are used to create PGPOptionListRef's for +** specifying the various options to several SDK functions. The +** functions can be used as inline parameters in a temporary manner or +** used with PGPBuildOptionList() to create persistent lists. +*/ + +/* +** Special PGPOptionListRef to mark last option passed to those functions +** which take variable lists of PGPOptionListRef's: +*/ + +PGPOptionListRef PGPOLastOption( PGPContextRef context ); + +/* Special PGPOptionListRef which is always ignored: */ + +PGPOptionListRef PGPONullOption( PGPContextRef context); + +/* Data input (required): */ + +PGPOptionListRef PGPOInputFile( PGPContextRef context, + PGPFileSpecRef fileRef ); +PGPOptionListRef PGPOInputBuffer( PGPContextRef context, + void const *buffer, PGPSize bufferSize ); +#if PGP_MACINTOSH || PGP_OSX +PGPOptionListRef PGPOInputFileFSSpec( PGPContextRef context, + const struct FSSpec *fileSpec ); +#endif + +/* Data output (optional, generates event if missing): */ + +PGPOptionListRef PGPOOutputFile( PGPContextRef context, + PGPFileSpecRef fileRef ); +PGPOptionListRef PGPOOutputBuffer( PGPContextRef context, + void *buffer, PGPSize bufferSize, + PGPSize *outputDataLength ); +PGPOptionListRef PGPOOutputDirectory( PGPContextRef context, + PGPFileSpecRef fileRef ); +#if PGP_MACINTOSH || PGP_OSX +PGPOptionListRef PGPOOutputFileFSSpec( PGPContextRef context, + const struct FSSpec *fileSpec ); +#endif + +/* Filepath modifiers (used for Archiving )*/ + +PGPOptionListRef PGPORelativePath( PGPContextRef context, + PGPFileSpecRef dirRef ); + +PGPOptionListRef PGPORootPath( PGPContextRef context, + PGPFileSpecRef dirRef ); + +/* '*buffer' must be disposed of via PGPFreeData() */ +/* maximum memory usage will be no more than maximumBufferSize */ +PGPOptionListRef PGPOAllocatedOutputBuffer(PGPContextRef context, + void **buffer, PGPSize maximumBufferSize, + PGPSize *actualBufferSize); +PGPOptionListRef PGPOAppendOutput( PGPContextRef context, + PGPBoolean appendOutput ); +PGPOptionListRef PGPODiscardOutput( PGPContextRef context, + PGPBoolean discardOutput ); +PGPOptionListRef PGPOAllocatedOutputKeyContainer(PGPContextRef context, + void **keyContName, PGPSize maximumKeyContNameSize, + PGPSize *actualKeyContNameSize ); + +/* Encrypting and signing */ + +PGPOptionListRef PGPOEncryptToKeyDBObj( PGPContextRef context, + PGPKeyDBObjRef keyDBObjRef); +PGPOptionListRef PGPOEncryptToKeySet( PGPContextRef context, + PGPKeySetRef keySetRef); +PGPOptionListRef PGPOIntegrityProtection( PGPContextRef context, + PGPBoolean integrity); +PGPOptionListRef PGPOSignWithKey( PGPContextRef context, + PGPKeyDBObjRef keyDBObjRef, + PGPOptionListRef firstOption, ...); +PGPOptionListRef PGPOConventionalEncrypt( PGPContextRef context, + PGPOptionListRef firstOption, + ...); +#undef PGPOPassphraseBuffer +PGPOptionListRef PGPOPassphraseBuffer( PGPContextRef context, + const PGPChar8 *passphrase, + PGPSize passphraseLength); +#undef PGPOPassphrase +PGPOptionListRef PGPOPassphrase( PGPContextRef context, + const PGPChar8 *passphrase); +PGPOptionListRef PGPOPasskeyBuffer( PGPContextRef context, + const void *passkey, PGPSize passkeyLength); + +PGPOptionListRef PGPOCachePassphrase( PGPContextRef context, + PGPUInt32 timeOutSeconds, PGPBoolean globalCache); +PGPOptionListRef PGPOSessionKey( PGPContextRef context, + const void *sessionKey, PGPSize sessionKeyLength); +PGPOptionListRef PGPOSignedHash( PGPContextRef context, + void const *hash, PGPSize hashSize ); +PGPOptionListRef PGPOAllowBareESKs( PGPContextRef context, + PGPBoolean allowBareESKs ); +PGPOptionListRef PGPOAskUserForEntropy( PGPContextRef context, + PGPBoolean askUserForEntropy ); +PGPOptionListRef PGPORawPGPInput( PGPContextRef context, + PGPBoolean rawPGPInput ); +PGPOptionListRef PGPOCompression( PGPContextRef context, + PGPBoolean compression ); + +PGPOptionListRef PGPOLocalEncoding( PGPContextRef context, + PGPLocalEncodingFlags localEncode); +PGPOptionListRef PGPOOutputLineEndType(PGPContextRef context, + PGPLineEndType lineEnd); +#undef PGPOPGPMIMEEncoding +PGPOptionListRef PGPOPGPMIMEEncoding(PGPContextRef context, + PGPBoolean mimeEncoding, PGPSize *mimeBodyOffset, + PGPChar8 mimeSeparator[ kPGPMimeSeparatorSize ]); +PGPOptionListRef PGPOOmitMIMEVersion( PGPContextRef context, + PGPBoolean omitVersion); +PGPOptionListRef PGPOX509Encoding( PGPContextRef context, + PGPBoolean x509Encoding); + +PGPOptionListRef PGPODetachedSig( PGPContextRef context, + PGPOptionListRef firstOption, + ...); + +PGPOptionListRef PGPOCipherAlgorithm( PGPContextRef context, + PGPCipherAlgorithm algorithm); +PGPOptionListRef PGPOHashAlgorithm( PGPContextRef context, + PGPHashAlgorithm algorithm); +PGPOptionListRef PGPOCompressionAlgorithm( PGPContextRef context, + PGPCompressionAlgorithm algorithm); + +PGPOptionListRef PGPOFailBelowValidity( PGPContextRef context, + PGPValidity minValidity); +PGPOptionListRef PGPOWarnBelowValidity( PGPContextRef context, + PGPValidity minValidity); + + +PGPOptionListRef PGPOEventHandler( PGPContextRef context, + PGPEventHandlerProcPtr eventHandler, + PGPUserValue eventHandlerData); +PGPOptionListRef PGPOSendNullEvents( PGPContextRef context, + PGPTimeInterval approxInterval); + +PGPOptionListRef PGPOArmorOutput( PGPContextRef context, + PGPBoolean armorOutput ); +PGPOptionListRef PGPODataIsASCII( PGPContextRef context, + PGPBoolean dataIsASCII ); +PGPOptionListRef PGPOClearSign( PGPContextRef context, + PGPBoolean clearSign ); +PGPOptionListRef PGPOForYourEyesOnly( PGPContextRef context, + PGPBoolean forYourEyesOnly ); +PGPOptionListRef PGPOKeyDBRef( PGPContextRef context, + PGPKeyDBRef keydbRef); + +PGPOptionListRef PGPOExportKeySet( PGPContextRef context, + PGPKeySetRef keysetRef); +PGPOptionListRef PGPOExportKeyDBObj( PGPContextRef context, + PGPKeyDBObjRef keyDBObjRef); + +PGPOptionListRef PGPOImportKeysTo( PGPContextRef context, + PGPKeyDBRef keydbRef); +PGPOptionListRef PGPOSendEventIfKeyFound( PGPContextRef context, + PGPBoolean sendEventIfKeyFound ); +PGPOptionListRef PGPOPassThroughIfUnrecognized( PGPContextRef context, + PGPBoolean passThroughIfUnrecognized ); +PGPOptionListRef PGPOPassThroughClearSigned( PGPContextRef context, + PGPBoolean passThroughClearSigned ); +PGPOptionListRef PGPOPassThroughKeys( PGPContextRef context, + PGPBoolean passThroughKeys ); +PGPOptionListRef PGPORecursivelyDecode( PGPContextRef context, + PGPBoolean recurse ); + +PGPOptionListRef PGPOKeyGenParams( PGPContextRef context, + PGPPublicKeyAlgorithm pubKeyAlg, + PGPUInt32 bits); + +#undef PGPOKeyGenName +PGPOptionListRef PGPOKeyGenName( PGPContextRef context, + const void *name, PGPSize nameLength); + +PGPOptionListRef PGPOCreationDate( PGPContextRef context, + PGPTime creationDate); +PGPOptionListRef PGPOExpiration( PGPContextRef context, + PGPUInt32 expirationDays); + +PGPOptionListRef PGPOAdditionalRecipientRequestKeySet( + PGPContextRef context, + PGPKeySetRef arKeySetRef, PGPByte arkClass); + +PGPOptionListRef PGPORevocationKeySet(PGPContextRef context, + PGPKeySetRef raKeySetRef); + +PGPOptionListRef PGPOKeyGenMasterKey( PGPContextRef context, + PGPKeyDBObjRef masterKeyDBObjRef); + +PGPOptionListRef PGPOPreferredAlgorithms( + PGPContextRef context, + PGPCipherAlgorithm const *prefAlg, + PGPUInt32 numAlgs); + +#undef PGPOPreferredKeyServer +PGPOptionListRef PGPOPreferredKeyServer( + PGPContextRef context, + PGPChar8 const * server ); + +PGPOptionListRef PGPOKeyFeatures( PGPContextRef context, + PGPUInt32 features); + +PGPOptionListRef PGPOKeyFlags( PGPContextRef context, + PGPUInt32 flags); + +PGPOptionListRef PGPOKeyServerPreferences( PGPContextRef context, + PGPUInt32 preferences); + +PGPOptionListRef PGPOKeyGenFast( PGPContextRef context, + PGPBoolean fastGen); + +PGPOptionListRef PGPOTokenNumber( PGPContextRef context, + PGPUInt32 tokenID); +#define PGPOKeyGenOnToken PGPOTokenNumber + +PGPOptionListRef PGPOOutputToken( PGPContextRef context, PGPUInt32 token ); + +PGPOptionListRef PGPOKeyContainer( PGPContextRef context, + const PGPByte *keyContainerName, + PGPSize keyContainerNameSize ); + +PGPOptionListRef PGPOKeyGenUseExistingEntropy( PGPContextRef context, + PGPBoolean useExistingEntropy); + +PGPOptionListRef PGPOPreferredCompressionAlgorithms( + PGPContextRef context, + PGPCompressionAlgorithm const *prefAlg, + PGPUInt32 numAlgs); + +#undef PGPOCommentString +PGPOptionListRef PGPOCommentString( PGPContextRef context, + PGPChar8 const *comment); + +#undef PGPOVersionString +PGPOptionListRef PGPOVersionString( PGPContextRef context, + PGPChar8 const *version); + +#undef PGPOFileNameString +PGPOptionListRef PGPOFileNameString( PGPContextRef context, + PGPChar8 const *fileName); + +#undef PGPOSigRegularExpression +PGPOptionListRef PGPOSigRegularExpression(PGPContextRef context, + PGPChar8 const *regularExpression); + +PGPOptionListRef PGPOExportPrivateKeys( PGPContextRef context, + PGPBoolean exportKeys); + +PGPOptionListRef PGPOExportPrivateSubkeys( PGPContextRef context, + PGPBoolean exportSubkeys); + +PGPOptionListRef PGPOExportFormat(PGPContextRef context, + PGPExportFormat exportFormat); + +PGPOptionListRef PGPOExportable( PGPContextRef context, + PGPBoolean exportable); + +PGPOptionListRef PGPOSigTrust( PGPContextRef context, + PGPUInt32 trustLevel, + PGPUInt32 trustValue); + +PGPOptionListRef PGPOInputFormat( PGPContextRef context, + PGPInputFormat inputFormat ); + +PGPOptionListRef PGPOOutputFormat( PGPContextRef context, + PGPOutputFormat outputFormat ); + +PGPOptionListRef PGPOAttributeValue( PGPContextRef context, + PGPAttributeValue *attributeValue, + PGPUInt32 attributeValueCount); + +PGPOptionListRef PGPOInputTARCache( PGPContextRef context, + PGPFileSpecRef cacheFileRef, + const PGPByte *sessionKey, + PGPSize sessionKeySize ); + +PGPOptionListRef PGPOOutputTARCache( PGPContextRef context, + PGPFileSpecRef cacheFileRef ); + +PGPOptionListRef PGPOIssueRevocations( PGPContextRef context, + PGPBoolean issueRevocations ); + +PGPOptionListRef PGPOSMIMEMatchCriterion( PGPContextRef context, + PGPSMIMEMatchCriterion criterion ); + +PGPOptionListRef PGPOSMIMESigner( PGPContextRef context, + PGPKeyDBObjRef signer ); + + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpOptionList_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPFLConfig.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPFLConfig.h new file mode 100644 index 0000000000..8474d66aa0 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPFLConfig.h @@ -0,0 +1,52 @@ +/*____________________________________________________________________________ + pgpPFLConfig.h (Win32 version) + + Copyright (C) 2002 PGP Corporation + All rights reserved. + + This file contains the Win32 version of the configuration file + normally generated by the automatic configure script on Unix. + + $Id: pgpPFLConfig.h,v 1.3 2002/08/06 20:10:45 dallen Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpPFLConfig_h /* [ */ +#define Included_pgpPFLConfig_h + +#define HAVE_STDARG_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_UNISTD_H 0 +#define HAVE_USHORT 0 +#define HAVE_UINT 0 +#define HAVE_ULONG 0 +#define NO_LIMITS_H 0 +#define NO_POPEN 1 + +#if defined( __MWERKS__ ) + + #define PGP_HAVE64 0 + + +#elif defined( _MSC_VER ) + // wjb-for FileOffsets to be 64 bit + #define PGP_HAVE64 1 + typedef __int64 PGPInt64; + typedef unsigned __int64 PGPUInt64; + + + +#endif + + + + +#endif /* ] Included_pgpPFLConfig_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPFLErrors.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPFLErrors.h new file mode 100644 index 0000000000..f0264cafd0 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPFLErrors.h @@ -0,0 +1,116 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpPFLErrors.h,v 1.20 2004/04/25 03:31:03 bzhao Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpPFLErrors_h /* [ */ +#define Included_pgpPFLErrors_h + +#include "pgpBase.h" + +#define kPGPPFLErrorBase -12000 +#define kPGPPFLErrorRange 500 + +enum +{ + /* + NOTE: error numbers must not be changed as compile clients depend on them. + */ + + kPGPError_NoErr = 0, + + kPGPError_BadParams = -12000, + kPGPError_OutOfMemory = -11999, + kPGPError_BufferTooSmall = -11998, + + kPGPError_FileNotFound = -11997, + kPGPError_CantOpenFile = -11996, + kPGPError_FilePermissions = -11995, + kPGPError_FileLocked = -11994, + /* Unused = -11993, */ + kPGPError_IllegalFileOp = -11992, + kPGPError_FileOpFailed = -11991, + kPGPError_ReadFailed = -11990, + kPGPError_WriteFailed = -11989, + kPGPError_EOF = -11988, + + kPGPError_UserAbort = -11987, + kPGPError_UnknownRequest = -11986, + kPGPError_LazyProgrammer = -11985, + kPGPError_ItemNotFound = -11984, + kPGPError_ItemAlreadyExists = -11983, + kPGPError_AssertFailed = -11982, + kPGPError_BadMemAddress = -11981, + kPGPError_UnknownError = -11980, + + kPGPError_PrefNotFound = -11979, + kPGPError_EndOfIteration = -11978, + kPGPError_ImproperInitialization = -11977, + kPGPError_CorruptData = -11976, + kPGPError_FeatureNotAvailable = -11975, + kPGPError_MatchNotFound = -11974, + kPGPError_ResourceUnavailable = -11973, + kPGPError_InsufficientPrivileges = -11972, + kPGPError_AlreadyInUse = -11971, + kPGPError_Deadlocked = -11970, + kPGPError_NotConnected = -11969, + kPGPError_BufferTooLarge = -11968, + kPGPError_SizeTooLarge = -11967, + + kPGPError_DiskFull = -11960, + kPGPError_DiskLocked = -11959, + + kPGPError_GraphicsOpFailed = -11956, + kPGPError_MemoryOpFailed = -11955, + kPGPError_NetworkOpFailed = -11954, + kPGPError_SecurityOpFailed = -11953, + kPGPError_StringOpFailed = -11952, + kPGPError_SyncObjOpFailed = -11951, + kPGPError_ThreadOpFailed = -11950, + kPGPError_VolumeOpFailed = -11949, + + kPGPError_NTDrvIopOpFailed = -11947, + kPGPError_NTDrvObjectOpFailed = -11946, + + kPGPError_Win32COMOpFailed = -11945, + kPGPError_Win32CommCtrlOpFailed = -11944, + kPGPError_Win32DllOpFailed = -11943, + kPGPError_Win32RegistryOpFailed = -11942, + kPGPError_Win32ResourceOpFailed = -11941, + kPGPError_Win32WindowOpFailed = -11940, + kPGPError_RPCFailed = -11939, + kPGPError_RPCGarbledMsg = -11938, + kPGPError_NoUnicodeEquivalent = -11937, + + kPGPError_NetLARefused = -11936, + kPGPError_NetLAMismatch = -11935, + kPGPError_NetLATooManyRetrievals = -11934, + kPGPError_LNCorrupt = -11933, + kPGPError_LACorrupt = -11932, + kPGPError_LNInvalid = -11931, + kPGPError_NetInvalidProdID = -11930, + // PGPwde error code + kPGPError_DiskNotFound = -11929, + kPGPError_LastPFLError = kPGPPFLErrorBase + kPGPPFLErrorRange - 1 +}; + +#define IsPGPError( err ) ( (err) != kPGPError_NoErr ) +#define IsntPGPError( err ) ( (err) == kPGPError_NoErr ) + +PGP_BEGIN_C_DECLARATIONS + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpPFLErrors_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPubTypes.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPubTypes.h new file mode 100644 index 0000000000..6082d4bb62 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPubTypes.h @@ -0,0 +1,350 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpPubTypes.h,v 1.22 2004/04/13 20:50:53 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpPubTypes_h /* [ */ +#define Included_pgpPubTypes_h + +#include "pgpConfig.h" +#include "pgpBase.h" + +/*____________________________________________________________________________ + General data types used by PGPsdk +____________________________________________________________________________*/ + +typedef struct PGPContext * PGPContextRef; +typedef struct PGPFileSpec * PGPFileSpecRef; +typedef struct PGPOptionList * PGPOptionListRef; + +/*____________________________________________________________________________ + Data types used by the key manipulation functions +____________________________________________________________________________*/ + +typedef struct PGPKeyDB * PGPKeyDBRef; +typedef struct PGPKeyDBObj * PGPKeyDBObjRef; +typedef struct PGPKeySet * PGPKeySetRef; +typedef struct PGPKeyList * PGPKeyListRef; +typedef struct PGPKeyIter * PGPKeyIterRef; +typedef struct PGPFilter * PGPFilterRef; + +typedef struct PGPKeyID +{ + /* do not attempt to interpret these bytes; they *will* change */ + PGPByte opaqueBytes[ 36 ]; +} PGPKeyID; + +/*____________________________________________________________________________ + Data types used by symmetric ciphers, cipher modes, hashing +____________________________________________________________________________*/ + +typedef struct PGPHashContext * PGPHashContextRef; +typedef struct PGPHMACContext * PGPHMACContextRef; +typedef struct PGPPublicKeyContext * PGPPublicKeyContextRef; +typedef struct PGPPrivateKeyContext * PGPPrivateKeyContextRef; +typedef struct PGPCBCContext * PGPCBCContextRef; +typedef struct PGPCFBContext * PGPCFBContextRef; +typedef struct PGPSymmetricCipherContext * PGPSymmetricCipherContextRef; + +/*____________________________________________________________________________ +Disk Wiping Patterns +____________________________________________________________________________*/ + +typedef struct PGPWipePatternContext * PGPWipePatternContextRef; + +/*____________________________________________________________________________ +PGP Tar Cache, Objects and Iterators +____________________________________________________________________________*/ +typedef struct PGPTARCache * PGPTARCacheRef; +typedef struct PGPTARCacheIter * PGPTARCacheIterRef; +typedef struct PGPTARCacheObj * PGPTARCacheObjRef; + +/*____________________________________________________________________________ + Data types used by keyserver code +____________________________________________________________________________*/ + +typedef struct PGPKeyServer * PGPKeyServerRef; + +/*____________________________________________________________________________ + Invalid values for each of the "ref" data types. Use these for assignment + and initialization only. Use the PGPXXXRefIsValid macros (below) to test + for valid/invalid values. +____________________________________________________________________________*/ + +#define kInvalidPGPContextRef ((PGPContextRef) NULL) +#define kInvalidPGPFileSpecRef ((PGPFileSpecRef) NULL) +#define kInvalidPGPOptionListRef ((PGPOptionListRef) NULL) +#define kInvalidPGPKeyDBRef ((PGPKeyDBRef) NULL) +#define kInvalidPGPKeyDBObjRef ((PGPKeyDBObjRef) NULL) +#define kInvalidPGPKeySetRef ((PGPKeySetRef) NULL) +#define kInvalidPGPKeyListRef ((PGPKeyListRef) NULL) +#define kInvalidPGPKeyIterRef ((PGPKeyIterRef) NULL) +#define kInvalidPGPFilterRef ((PGPFilterRef) NULL) +#define kInvalidPGPKeyServerRef ((PGPKeyServerRef) NULL) +#define kInvalidPGPHashContextRef ((PGPHashContextRef) NULL) +#define kInvalidPGPHMACContextRef ((PGPHMACContextRef) NULL) +#define kInvalidPGPCFBContextRef ((PGPCFBContextRef) NULL) +#define kInvalidPGPCBCContextRef ((PGPCBCContextRef) NULL) + +#define kInvalidPGPSymmetricCipherContextRef \ + ((PGPSymmetricCipherContextRef) NULL) +#define kInvalidPGPPublicKeyContextRef \ + ((PGPPublicKeyContextRef) NULL) +#define kInvalidPGPPrivateKeyContextRef \ + ((PGPPrivateKeyContextRef) NULL) +#define kInvalidPGWipePatternContextRef \ + ((PGPWipePatternContextRef) NULL) +#define kInvalidPGPTARCacheRef \ + ((PGPTARCacheRef) NULL) +#define kInvalidPGPTARCacheIterRef \ + ((PGPTARCacheIterRef) NULL) +#define kInvalidPGPTARCacheObjRef \ + ((PGPTARCacheObjRef) NULL) + + +/*____________________________________________________________________________ + Macros to test for ref validity. Use these in preference to comparing + directly with the kInvalidXXXRef values. +____________________________________________________________________________*/ + +#define PGPContextRefIsValid( ref ) ( (ref) != kInvalidPGPContextRef ) +#define PGPFileSpecRefIsValid( ref ) ( (ref) != kInvalidPGPFileSpecRef ) +#define PGPOptionListRefIsValid( ref ) ( (ref) != kInvalidPGPOptionListRef ) +#define PGPKeyDBRefIsValid( ref ) ( (ref) != kInvalidPGPKeyDBRef ) +#define PGPKeyDBObjRefIsValid( ref ) ( (ref) != kInvalidPGPKeyDBObjRef ) +#define PGPKeySetRefIsValid( ref ) ( (ref) != kInvalidPGPKeySetRef ) +#define PGPKeyListRefIsValid( ref ) ( (ref) != kInvalidPGPKeyListRef ) +#define PGPKeyIterRefIsValid( ref ) ( (ref) != kInvalidPGPKeyIterRef ) +#define PGPFilterRefIsValid( ref ) ( (ref) != kInvalidPGPFilterRef ) +#define PGPKeyServerRefIsValid( ref ) ( (ref) != kInvalidPGPKeyServerRef ) +#define PGPHashContextRefIsValid( ref ) ( (ref) != kInvalidPGPHashContextRef ) +#define PGPHMACContextRefIsValid( ref ) ( (ref) != kInvalidPGPHMACContextRef ) +#define PGPCFBContextRefIsValid( ref ) ( (ref) != kInvalidPGPCFBContextRef ) +#define PGPCBCContextRefIsValid( ref ) ( (ref) != kInvalidPGPCBCContextRef ) + +#define PGPSymmetricCipherContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPSymmetricCipherContextRef ) +#define PGPPublicKeyContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPPublicKeyContextRef ) +#define PGPPrivateKeyContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPPrivateKeyContextRef ) +#define PGPWipePatternContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGWipePatternContextRef ) + #define PGPTARCacheRefIsValid( ref ) \ + ( (ref) != kInvalidPGPTARCacheRef ) +#define PGPTARCacheObjRefIsValid( ref ) \ + ( (ref) != kInvalidPGPTARCacheObjRef ) +#define PGPTARCacheIterRefIsValid( ref) \ + ( (ref) != kInvalidPGPTARCacheIterRef ) + +/*____________________________________________________________________________ + Symmetric Ciphers +____________________________________________________________________________*/ + +enum PGPCipherAlgorithm_ +{ + kPGPCipherAlgorithm_None = 0, + kPGPCipherAlgorithm_IDEA = 1, + kPGPCipherAlgorithm_3DES = 2, + kPGPCipherAlgorithm_CAST5 = 3, + kPGPCipherAlgorithm_Blowfish = 4, + kPGPCipherAlgorithm_AES128 = 7, + kPGPCipherAlgorithm_AES192 = 8, + kPGPCipherAlgorithm_AES256 = 9, + kPGPCipherAlgorithm_Twofish256 = 10, + + PGP_ENUM_FORCE( PGPCipherAlgorithm_ ) +}; +PGPENUM_TYPEDEF( PGPCipherAlgorithm_, PGPCipherAlgorithm ); + +/*____________________________________________________________________________ + Hash algorithms +____________________________________________________________________________*/ + +enum PGPHashAlgorithm_ +{ + kPGPHashAlgorithm_Invalid = 0, + kPGPHashAlgorithm_MD5 = 1, + kPGPHashAlgorithm_SHA = 2, + kPGPHashAlgorithm_RIPEMD160 = 3, + kPGPHashAlgorithm_SHA256 = 8, /* from draft-ietf-openpgp-rfc2440bis-03.txt */ + kPGPHashAlgorithm_SHA384 = 9, + kPGPHashAlgorithm_SHA512 = 10, + + PGP_ENUM_FORCE( PGPHashAlgorithm_ ) +}; +PGPENUM_TYPEDEF( PGPHashAlgorithm_, PGPHashAlgorithm ); + +/*____________________________________________________________________________ + Public/Private key algorithms +____________________________________________________________________________*/ +enum PGPPublicKeyAlgorithm_ +{ +#ifdef __MVS__ + kPGPPublicKeyAlgorithm_Invalid = -1, +#else + kPGPPublicKeyAlgorithm_Invalid = 0xFFFFFFFF, +#endif + kPGPPublicKeyAlgorithm_RSA = 1, + kPGPPublicKeyAlgorithm_RSAEncryptOnly = 2, + kPGPPublicKeyAlgorithm_RSASignOnly = 3, + kPGPPublicKeyAlgorithm_ElGamal = 0x10, /* A.K.A.Diffie-Hellman */ + kPGPPublicKeyAlgorithm_DSA = 0x11, + kPGPPublicKeyAlgorithm_ECEncrypt = 0x12, + kPGPPublicKeyAlgorithm_ECSign = 0x13, + + PGP_ENUM_FORCE( PGPPublicKeyAlgorithm_ ) +}; +PGPENUM_TYPEDEF( PGPPublicKeyAlgorithm_, PGPPublicKeyAlgorithm ); + +/*____________________________________________________________________________ + Trust values, used to set validity values +____________________________________________________________________________*/ + +#define kPGPKeyTrust_Mask 0x7u +#define kPGPKeyTrust_Undefined 0x0u +#define kPGPKeyTrust_Unknown 0x1u +#define kPGPKeyTrust_Never 0x2u +#define kPGPKeyTrust_Marginal 0x5u +#define kPGPKeyTrust_Complete 0x6u +#define kPGPKeyTrust_Ultimate 0x7u + +#define kPGPUserIDTrust_Mask 0x3u +#define kPGPUserIDTrust_Unknown 0x0u +#define kPGPUserIDTrust_Untrusted 0x1u +#define kPGPUserIDTrust_Marginal 0x2u +#define kPGPUserIDTrust_Complete 0x3u + +/*____________________________________________________________________________ + Validity levels, used for thresholds in options +____________________________________________________________________________*/ + +enum PGPValidity_ +{ + kPGPValidity_Unknown = kPGPUserIDTrust_Unknown, + kPGPValidity_Invalid = kPGPUserIDTrust_Untrusted, + kPGPValidity_Marginal = kPGPUserIDTrust_Marginal, + kPGPValidity_Complete = kPGPUserIDTrust_Complete, + + PGP_ENUM_FORCE( PGPValidity_ ) +} ; +PGPENUM_TYPEDEF( PGPValidity_, PGPValidity ); + +/*____________________________________________________________________________ + Line endings types +____________________________________________________________________________*/ + +enum PGPLineEndType_ +{ + kPGPLineEnd_Default = 0, + kPGPLineEnd_LF = 1, + kPGPLineEnd_CR = 2, + kPGPLineEnd_CRLF = (kPGPLineEnd_LF | kPGPLineEnd_CR), + + PGP_ENUM_FORCE( PGPLineEndType_ ) +}; +PGPENUM_TYPEDEF( PGPLineEndType_, PGPLineEndType ); + +/*____________________________________________________________________________ + Local encoding types + + Only one of Force or Auto should be used. The other values are modifiers +____________________________________________________________________________*/ + +#define kPGPLocalEncoding_None 0x0 /* nothing on */ +#define kPGPLocalEncoding_Force 0x01 +#define kPGPLocalEncoding_Auto 0x02 +#define kPGPLocalEncoding_NoMacBinCRCOkay 0x04 + +typedef PGPFlags PGPLocalEncodingFlags; + + +/* max length is 255; the +1 is for the trailing \0 */ +#define kPGPMaxUserIDSize ( (PGPSize)255 + 1 ) + +/* Size of buffer for PGP-MIME separator (null terminated) */ +#define kPGPMimeSeparatorSize 81 + +enum PGPTokenProperty_ +{ + kPGPTokenProperty_Invalid = 0, + + /* boolean properties */ + kPGPTokenProperty_DirectAuth = 1, + + /* numeric properties */ + kPGPTokenProperty_KeyGenAlgorithm = 100, + kPGPTokenProperty_PrivateKeys = 101, + kPGPTokenProperty_PublicKeys = 102, + kPGPTokenProperty_SlotID = 103, + kPGPTokenProperty_MinPINSize = 104, + kPGPTokenProperty_MaxPINSize = 105, + kPGPTokenProperty_MinKeySize = 106, + kPGPTokenProperty_MaxKeySize = 107, + + /* string / data properties */ + kPGPTokenProperty_SerialNumber = 500, + kPGPTokenProperty_Model = 501, + kPGPTokenProperty_ManufacturerID = 502, + kPGPTokenProperty_TokenLabel = 503, + + PGP_ENUM_FORCE( PGPTokenProperty_ ) +}; +PGPENUM_TYPEDEF( PGPTokenProperty_, PGPTokenProperty ); + +/* Token capabilities / information. 4 byte packing. + * Deprecated, use PGPTokenInfoGet*() with PGPTokenProperty + * + */ +typedef struct _PGPTokenInfo { + /* The size of the structure, including this field. + Must be the first field */ + PGPUInt32 size; + + /* Identification information */ + PGPByte manufacturerID[32]; + PGPByte model[16]; + PGPByte serialNumber[16]; + + PGPBoolean bRsa; + PGPUInt32 minRsaKeySize; + PGPUInt32 maxRsaKeySize; + + /* General capabilities */ + PGPUInt32 minPinLen; + PGPUInt32 maxPinLen; + + /* Number of objects */ + PGPUInt32 numPrivKeys; /* Possibly, non-PGP keys */ + PGPUInt32 numPubKeys; /* Possibly, non-PGP keys */ + + PGPByte reserved[4]; +} PGPTokenInfo; + +/*____________________________________________________________________________ + Compression algorithms +____________________________________________________________________________*/ + +enum PGPCompressionAlgorithm_ +{ + kPGPCompressionAlgorithm_None = 0, + kPGPCompressionAlgorithm_ZIP = 1, + kPGPCompressionAlgorithm_ZLIB = 2, + kPGPCompressionAlgorithm_BZIP2 = 3, + + PGP_ENUM_FORCE( PGPCompressionAlgorithm_ ) +}; +PGPENUM_TYPEDEF( PGPCompressionAlgorithm_, PGPCompressionAlgorithm ); + +#endif /* ] Included_pgpPubTypes_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPublicKey.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPublicKey.h new file mode 100644 index 0000000000..8ed1adc9ae --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpPublicKey.h @@ -0,0 +1,207 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpPublicKey.h,v 1.9 2003/10/03 00:38:40 vinnie Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpPublicKey_h /* [ */ +#define Included_pgpPublicKey_h + +#include "pgpPubTypes.h" +#include "pgpOptionList.h" + +/*____________________________________________________________________________ + Encryption/Signature Message Formats +____________________________________________________________________________*/ + +enum PGPPublicKeyMessageFormat_ +{ + kPGPPublicKeyMessageFormat_PGP = 1, + kPGPPublicKeyMessageFormat_PKCS1 = 2, + kPGPPublicKeyMessageFormat_X509 = 3, + kPGPPublicKeyMessageFormat_IKE = 4, + + kPGPPublicKeyMessageFormat_PKCS1_OAEP = 5, /* default is MGF1 with SHA1 */ + + PGP_ENUM_FORCE( PGPPublicKeyMessageFormat_ ) +}; +PGPENUM_TYPEDEF( PGPPublicKeyMessageFormat_, PGPPublicKeyMessageFormat ); + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + Public-key operations + + Return a context for public-key operations based on the specified key. + The specified message format is used for all operations with this + context. +____________________________________________________________________________*/ + +PGPError PGPNewPublicKeyContext( PGPKeyDBObjRef publicKeyDBObjRef, + PGPPublicKeyMessageFormat messageFormat, + PGPPublicKeyContextRef *outRef ); + +/*____________________________________________________________________________ + Dispose of a public-key context. +____________________________________________________________________________*/ + +PGPError PGPFreePublicKeyContext( PGPPublicKeyContextRef ref ); + +/*____________________________________________________________________________ + Determine maximum sizes for inputs and outputs. +____________________________________________________________________________*/ + +PGPError PGPGetPublicKeyOperationSizes( PGPPublicKeyContextRef ref, + PGPSize *maxDecryptedBufferSize, + PGPSize *maxEncryptedBufferSize, + PGPSize *maxSignatureSize ); + +/*____________________________________________________________________________ + Encrypt one block of data, using PKCS-1 padding. Output buffer must + be of size maxEncryptedBufferSize from PGPGetPublicKeyEncryptionSize. + outSize is a return parameter. For some formatting modes the actual + output size may be less than the maximum possible. +____________________________________________________________________________*/ + +PGPError PGPPublicKeyEncrypt( PGPPublicKeyContextRef ref, + void const *in, PGPSize inSize, void *out, + PGPSize *outSize ); + +/*____________________________________________________________________________ + Verify a signature on a message hash. Returns kPGPError_NoErr on + correct verification, else an error code. The message hash is + finalized and freed by this call (and should not have been finalized + prior to the call). +____________________________________________________________________________*/ + +PGPError PGPPublicKeyVerifySignature( PGPPublicKeyContextRef ref, + PGPHashContextRef hashContext, void const *signature, + PGPSize signatureSize ); + +/*____________________________________________________________________________ + Verify a signature on a low-level buffer. Returns kPGPError_NOErr + correct verification, else an error code. Not valid with + kPGPPublicKeyMessageFormat_PGP contexts. +____________________________________________________________________________*/ + +PGPError PGPPublicKeyVerifyRaw( PGPPublicKeyContextRef ref, + void const *signedData, PGPSize signedDataSize, + void const *signature, PGPSize signatureSize ); + +/*____________________________________________________________________________ + Private-key operations + + Return a context for private-key operations based on the specified + key (which must have a private part). The specified message + format is used for all operations with this context. Unlocks key + data using passphrase. +____________________________________________________________________________*/ + +PGPError PGPNewPrivateKeyContext( PGPKeyDBObjRef privateKeyDBObjRef, + PGPPublicKeyMessageFormat messageFormat, + PGPPrivateKeyContextRef *outRef, + PGPOptionListRef firstOption, ...); + +/*____________________________________________________________________________ + Dispose of a private-key context. All sensitive data is wiped before + being deleted. +____________________________________________________________________________*/ + +PGPError PGPFreePrivateKeyContext( PGPPrivateKeyContextRef ref ); + +/*____________________________________________________________________________ + Determine maximum sizes for inputs and outputs. +____________________________________________________________________________*/ + +PGPError PGPGetPrivateKeyOperationSizes( PGPPrivateKeyContextRef ref, + PGPSize *maxDecryptedBufferSize, + PGPSize *maxEncryptedBufferSize, + PGPSize *maxSignatureSize); + +/*____________________________________________________________________________ + Decrypt one block of data. Output buffer must be of size at least + maxDecryptedBufferSize from PGPGetPrivateKeyDecryptionSize. + outSize is a return parameter. For some formatting modes the actual + output size may be less than the maximum possible. +____________________________________________________________________________*/ + +PGPError PGPPrivateKeyDecrypt( PGPPrivateKeyContextRef ref, void const *in, + PGPSize inSize, void *out, PGPSize *outSize ); + +/*____________________________________________________________________________ + Sign a message hash. Output signature buffer must be of size at + least maxSignatureSize from PGPGetPrivateKeyDecryptionSize. + signatureSize is a return parameter. For some formatting modes + the actual signature size may be less than the maximum possible. + The message hash is finalized and freed by this call (and should + not have been finalized prior to the call). +____________________________________________________________________________*/ + +PGPError PGPPrivateKeySign( PGPPrivateKeyContextRef ref, + PGPHashContextRef hashContext, void *signature, + PGPSize *signatureSize ); + +/*____________________________________________________________________________ + Sign a low level signedData buffer. Output signature buffer must be + of size at least maxSignatureSize from PGPGetPrivateKeyDecryptionSize. + signatureSize is a return parameter. Not valid with + kPGPPublicKeyMessageFormat_PGP contexts. +____________________________________________________________________________*/ + +PGPError PGPPrivateKeySignRaw( PGPPrivateKeyContextRef ref, + void const *signedData, PGPSize signedDataSize, + void *signature, PGPSize *signatureSize ); + +/*____________________________________________________________________________ + Miscellaneous operations +____________________________________________________________________________*/ + +/*____________________________________________________________________________ + Given the size of a prime modulus in bits, this returns an appropriate + size for an exponent in bits, such that the work factor to find a + discrete log modulo the modulus is approximately equal to half the + length of the exponent. This makes the exponent an appropriate size + for a subgroup in a discrete log signature scheme. For encryption + schemes, where decryption attacks can be stealthy and undetected, we + use 3/2 times the returned exponent size. +____________________________________________________________________________*/ + +PGPError PGPDiscreteLogExponentBits( PGPUInt32 modulusBits, + PGPUInt32 *exponentBits ); + + +/*____________________________________________________________________________ + Low level Function used for verifying FIPS 186-2 DSA signatures + using P, Q, G, Y key values. +____________________________________________________________________________*/ + +PGPError PGPDSAKeyVerifyRaw( + PGPContextRef context, + PGPByte const* P, + PGPSize PLen, + PGPByte const* Q, + PGPSize QLen, + PGPByte const* G, + PGPSize GLen, + PGPByte const* Y, + PGPSize YLen, + PGPByte const* sig, + PGPSize sigLen, + PGPByte const * hash, + PGPSize hashLen); + + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpPublicKey_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpRandomPool.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpRandomPool.h new file mode 100644 index 0000000000..b965b498d3 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpRandomPool.h @@ -0,0 +1,46 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpRandomPool.h,v 1.7 2002/08/06 20:11:16 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpRandomPool_h /* [ */ +#define Included_pgpRandomPool_h + +#include "pgpBase.h" +#include "pflTypes.h" + +PGP_BEGIN_C_DECLARATIONS + +PGPError PGPSetRandSeedFile( PFLFileSpecRef randSeedFile ); + +PGPUInt32 PGPGlobalRandomPoolAddKeystroke( PGPInt32 event); +PGPUInt32 PGPGlobalRandomPoolMouseMoved(void); +PGPError PGPGlobalRandomPoolAddSystemState(void); +PGPBoolean PGPGlobalRandomPoolHasIntelRNG(void); + +/* Extra functions for entropy estimation */ +PGPUInt32 PGPGlobalRandomPoolGetEntropy( void ); +PGPUInt32 PGPGlobalRandomPoolGetSize( void ); +PGPUInt32 PGPGlobalRandomPoolGetMinimumEntropy( void ); +PGPBoolean PGPGlobalRandomPoolHasMinimumEntropy( void ); + + +#if PGP_DEPRECATED +PGPUInt32 PGPGlobalRandomPoolAddMouse( PGPUInt32 x, PGPUInt32 y); +#endif + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpRandomPool_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpReconstruct.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpReconstruct.h new file mode 100644 index 0000000000..756a19619e --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpReconstruct.h @@ -0,0 +1,117 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpReconstruct.h,v 1.1 2003/12/29 08:12:20 wprice Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpReconstruct_h /* [ */ +#define Included_pgpReconstruct_h + +#include "pgpPubTypes.h" +#include "pgpKeyServer.h" + +#define kPGPRecon_NumShares 5 +#define kPGPRecon_Threshold 3 +#define kPGPRecon_MaxPromptLen ( 96 - 1 ) +#define kPGPRecon_MaxURLLen ( 256 - 1 ) +#define kPGPRecon_MaxPassLen ( 256 - 1 ) +#define kPGPRecon_MaxUserNameLen ( 128 - 1 ) +#define kPGPRecon_MaxPasswordLen ( 128 - 1 ) + + +typedef struct PGPReconContext * PGPReconContextRef; + +#define kInvalidPGPReconContextRef ((PGPReconContextRef) NULL) +#define PGPReconContextRefIsValid( ref ) ( (ref) != kInvalidPGPReconContextRef ) + +typedef char PGPReconPrompts[kPGPRecon_NumShares][kPGPRecon_MaxPromptLen + 1]; + +typedef char PGPReconPasses[kPGPRecon_NumShares][kPGPRecon_MaxPassLen + 1]; + +typedef PGPError (*PGPReconstructEventHandler)(PGPContextRef recon, + PGPEvent *event, PGPUserValue userValue); + +/* inAuthUser and inAuthPass are not needed if the server class + is kPGPKeyServerClass_PGP. */ + PGPError +PGPNewReconstruct( + PGPKeyDBObjRef inTargetKey, + PGPUTF8 *inAuthUser, /* can be NULL */ + PGPUTF8 *inAuthPass, /* can be NULL */ + PGPReconstructEventHandler inHandler, + PGPUserValue inUserValue, + PGPReconContextRef *outRef ); + +/* This is only needed if you have to change the event handler after + allocating the PGPReconContextRef */ + PGPError +PGPSetReconstructionEventHandler( + PGPReconContextRef reconRef, + PGPReconstructEventHandler inHandler, + PGPUserValue inUserValue ); + + +/* I don't think it makes sense to support split keys for reconstruction, + so we only take a passphrase below */ + PGPError +PGPMakeReconstruction( + PGPReconContextRef reconRef, + PGPReconPrompts inPromptInfo, + PGPReconPasses inPassInfo, + PGPUTF8 *inPassphrase ); + + PGPError +PGPGetReconstruction( + PGPReconContextRef reconRef, + PGPByte **reconData, /* must be freed by caller */ + PGPSize *reconDataSize ); + + PGPError +PGPSendReconstruction( + PGPReconContextRef reconRef ); + + PGPError +PGPGetReconstructionPrompts( + PGPReconContextRef reconRef, + PGPReconPrompts outPromptInfo ); + + PGPError +PGPGetReconstructionData( + PGPReconContextRef reconRef, + PGPReconPasses inPassInfo, + PGPByte **outReconData, /* must be freed by caller */ + PGPSize *outReconSize ); + +/* Reconstructed private key will be returned in + outReconstructedKey if successful. The imported + key will have no passphrase and thus the user must + then be forced to choose a new passphrase. */ + PGPError +PGPReconstruct( + PGPReconContextRef reconRef, + PGPReconPasses inPassInfo, + PGPByte *inReconData, + PGPSize inReconDataSize, + PGPKeyDBRef *outReconstructedKey ); + + PGPError +PGPFreeReconstruct( + PGPReconContextRef reconRef ); + + PGPError +PGPSetReconstructionServerURL( + PGPReconContextRef reconRef, + PGPUTF8 *pszServerURL, + PGPKeyServerClass dwServerType ); + +#endif /* ] Included_pgpReconstruct_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSECSH.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSECSH.h new file mode 100644 index 0000000000..4a964f40ed --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSECSH.h @@ -0,0 +1,308 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpSECSH.h,v 1.5 2002/08/06 20:11:16 dallen Exp $ +____________________________________________________________________________*/ +#ifndef Included_PGPsecsh_h /* [ */ +#define Included_PGPsecsh_h + +#include "pgpPubTypes.h" + +PGP_BEGIN_C_DECLARATIONS + + +/* Message Types */ +#define kPGPsecsh_Msg_None 0 +#define kPGPsecsh_Msg_Disconnect 1 +#define kPGPsecsh_SMsg_PublicKey 2 +#define kPGPsecsh_CMsg_SessionKey 3 +#define kPGPsecsh_CMsg_User 4 +#define kPGPsecsh_CMsg_AuthRHosts 5 +#define kPGPsecsh_CMsg_AuthRSA 6 +#define kPGPsecsh_SMsg_AuthRSAChallenge 7 +#define kPGPsecsh_CMsg_AuthRSAResponse 8 +#define kPGPsecsh_CMsg_AuthRSAPassword 9 +#define kPGPsecsh_CMsg_RequestPTY 10 +#define kPGPsecsh_CMsg_WindowSize 11 +#define kPGPsecsh_CMsg_ExecShell 12 +#define kPGPsecsh_CMsg_ExecCommand 13 +#define kPGPsecsh_SMsg_Success 14 +#define kPGPsecsh_SMsg_Failure 15 +#define kPGPsecsh_CMsg_StdinData 16 +#define kPGPsecsh_SMsg_StdoutData 17 +#define kPGPsecsh_SMsg_StderrData 18 +#define kPGPsecsh_CMsg_EOF 19 +#define kPGPsecsh_SMsg_ExitStatus 20 +#define kPGPsecsh_Msg_ChannelOpenConfirm 21 +#define kPGPsecsh_Msg_ChannelOpenFailure 22 +#define kPGPsecsh_Msg_ChannelData 23 +#define kPGPsecsh_Msg_ChannelClose 24 +#define kPGPsecsh_Msg_ChannelCloseConfirm 25 +#define kPGPsecsh_SMsg_X11Open 27 +#define kPGPsecsh_CMsg_PortForwardRequest 28 +#define kPGPsecsh_Msg_PortOpen 29 +#define kPGPsecsh_CMsg_AgentRequestForwarding 30 +#define kPGPsecsh_SMsg_AgentOpen 31 +#define kPGPsecsh_Msg_Ignore 32 +#define kPGPsecsh_CMsg_ExitConfirm 33 +#define kPGPsecsh_CMsg_X11RequestForwarding 34 +#define kPGPsecsh_CMsg_AuthRHostsRSA 35 +#define kPGPsecsh_SMsg_Debug 36 +#define kPGPsecsh_CMsg_RequestCompression 37 +#define kPGPsecsh_CMsg_MaxPacketSize 38 +#define kPGPsecsh_CMsg_AuthTIS 39 +#define kPGPsecsh_SMsg_AuthTISChallenge 40 +#define kPGPsecsh_CMsg_AuthTISResponse 41 +#define kPGPsecsh_CMsg_AuthKerberos 42 +#define kPGPsecsh_SMsg_AuthKerberosResponse 43 +#define kPGPsecsh_CMsg_HaveKerberosTgt 44 + + +typedef struct PGPsecshContext * PGPsecshContextRef; +typedef const struct PGPsecshContext * PGPsecshConstContextRef; + +#define kInvalidPGPsecshContextRef ((PGPsecshContextRef) NULL) +#define PGPsecshContextRefIsValid( ref ) ( (ref) != kInvalidPGPsecshContextRef ) + +typedef struct PGPsecshSession * PGPsecshSessionRef; +typedef const struct PGPsecshSession * PGPsecshConstSessionRef; + +#define kInvalidPGPsecshSessionRef ((PGPsecshSessionRef) NULL) +#define PGPsecshSessionRefIsValid( ref ) ( (ref) != kInvalidPGPsecshSessionRef ) + + +typedef PGPFlags PGPsecshFlags; +#define kPGPsecshFlags_ServerSide 0x01 +#define kPGPsecshFlags_ClientSide 0x02 +#define kPGPsecshFlags_NonBlockingIO 0x04 + +typedef PGPFlags PGPsecshProtocolFlags; +#define kPGPsecshProtocolFlags_ScreenNumber 0x01 +#define kPGPsecshProtocolFlags_HostInFwdOpen 0x02 + +enum PGPsecshProtocolState_ +{ + kPGPsecsh_IdleState = 0, + kPGPsecsh_FatalErrorState = 1, + kPGPsecsh_ClosedState = 2, + kPGPsecsh_HandshakeState = 3, + kPGPsecsh_ReadyState = 4, + + PGP_ENUM_FORCE( PGPsecshProtocolState_ ) +}; +PGPENUM_TYPEDEF( PGPsecshProtocolState_, PGPsecshProtocolState ); + +enum PGPsecshAlert_ +{ + kPGPsecsh_AT_CloseNotify = 0, + kPGPsecsh_AT_UnexpectedMessage = 10, /* FATAL */ + kPGPsecsh_AT_BadRecordCRC = 20, /* FATAL */ + kPGPsecsh_AT_DecryptionFailed = 21, /* FATAL */ + kPGPsecsh_AT_RecordOverflow = 22, /* FATAL */ + kPGPsecsh_AT_DecompressionFailure = 30, /* FATAL */ + kPGPsecsh_AT_HandshakeFailure = 40, /* FATAL */ + kPGPsecsh_AT_IDFailure = 41, + kPGPsecsh_AT_UnsupportedVersion = 42, + kPGPsecsh_AT_UnsupportedCert = 43, + kPGPsecsh_AT_CertRevoked = 44, + kPGPsecsh_AT_CertExpired = 45, + kPGPsecsh_AT_CertUnknown = 46, + kPGPsecsh_AT_IllegalParameter = 47, /* FATAL */ + kPGPsecsh_AT_UnknownCA = 48, /* FATAL */ + kPGPsecsh_AT_AccessDenied = 49, /* FATAL */ + kPGPsecsh_AT_DecodeError = 50, /* FATAL */ + kPGPsecsh_AT_DecryptError = 51, + kPGPsecsh_AT_ExportRestriction = 60, /* FATAL */ + kPGPsecsh_AT_ProtocolVersion = 70, /* FATAL */ + kPGPsecsh_AT_InsufficientSecurity = 71, /* FATAL */ + kPGPsecsh_AT_InternalError = 80, /* FATAL */ + kPGPsecsh_AT_UserCancelled = 90, + kPGPsecsh_AT_NoRenegotiation = 100, + + kPGPsecsh_AT_None = 255, + + PGP_ENUM_FORCE( PGPsecshAlert_ ) +}; +PGPENUM_TYPEDEF( PGPsecshAlert_, PGPsecshAlert ); + +/* The Send and Receive function pointers should return + kPGPError_SECSHWouldBlock when the socket is non-blocking and the + call would block. The Send and Receive functions passed in will + need to translate the platform-specific socket error in appropriate + cases by using calls such as WSAGetLastError() on Win32. Remember + to call PGPsecshSendQueueIdle for non-blocking sockets also if + kPGPError_SECSHWouldBlock is returned from a send on a non-blocking + socket. */ + +typedef PGPInt32 (* PGPsecshReceiveProcPtr)(void *inData, void *outBuffer, + PGPInt32 inBufferSize); +typedef PGPInt32 (* PGPsecshSendProcPtr)(void *inData, const void *inBuffer, + PGPInt32 inBufferLength); + + +PGPError PGPNewSECSHContext( PGPContextRef context, + PGPsecshContextRef *outRef ); + +PGPError PGPFreeSECSHContext( PGPsecshContextRef ref ); + +/*____________________________________________________________________________ + The following function activates or deactivates the session key cache + for SECSH sessions. This defaults to on but can be deactivated with this + function to force all connections to proceed through the entire + handshake. +____________________________________________________________________________*/ +PGPError PGPsecshSetCache( PGPsecshContextRef ref, PGPBoolean useCache ); + +PGPError PGPsecshClearCache( PGPsecshContextRef ref ); + +PGPError PGPNewSECSHSession( PGPsecshContextRef ref, PGPsecshSessionRef *outRef ); + +PGPError PGPFreeSECSHSession( PGPsecshSessionRef ref ); + +PGPError PGPCopySECSHSession( PGPsecshSessionRef ref, PGPsecshSessionRef *outRef ); + +/* Default options are: client side, no protocol flags */ +PGPError PGPsecshSetProtocolOptions( PGPsecshSessionRef ref, + PGPsecshFlags options, + PGPsecshProtocolFlags pflags ); + + +/*____________________________________________________________________________ + The following function must be called to cleanly close a SECSH + connection. If it is not called, the session will not be able + to be resumed from the session cache. + + In the event the application determines any problem with the + connection such as the remote key not being valid, call this + function with dontCache set to true in order to not cache the + session keys. +____________________________________________________________________________*/ +PGPError PGPsecshClose( PGPsecshSessionRef ref, + PGPBoolean dontCache ); + +/*____________________________________________________________________________ + The following function must be called to initiate the PGPsecsh session. + Once a SECSH session has been assigned to a socket, no data can be sent + over that socket by the application until the handshake is completed. + Handshake completion is indicated by completion of this call without + error or by checking the state of the PGPsecshSession. It will be + kPGPsecsh_ReadyState when the application layer may send and receive + data securely. + + This function performs all negotiation of the SECSH connection. +____________________________________________________________________________*/ +PGPError PGPsecshHandshake( PGPsecshSessionRef ref ); + +/*____________________________________________________________________________ + The following function sets the local private authenticating key, + as well as other relevant data. + + The passphrase, key etc. are retained in memory. + It is an error not to specify a key. + This function must be passed either PGPOPassphrase or PGPOPasskeyBuffer. + inKeyObject must be in a PGP private key. inHostKeys should be a keyset + where the host key of the remote system is found, if we are checking + for consistency of that key. See PGPsecshGetRemoteAuthenticatedKey + for how to learn what host key was used. + inUserName is used to log in on the remote system. + inHostName is used for the username on the host key if it isn't found + on the inHostKeys keyset. +____________________________________________________________________________*/ +PGPError PGPsecshSetLocalPrivateKey( PGPsecshSessionRef ref, + char * inUserName, + PGPKeyDBObjRef inKeyObject, + char * inHostName, + PGPKeySetRef inHostKeys, + PGPOptionListRef firstOption, ... ); + +/*____________________________________________________________________________ + The following function gets the authenticated remote host key after a + successful handshake. You can call this function after a successful + handshake to verify that the remote key is authorized to make the + connection. The key returned will be on the inHostKeys keyset if it + matched one of the keys there; if it is a new host key which was not + in that keyset then it will be in a keyset & keydb of its own. +____________________________________________________________________________*/ +PGPError PGPsecshGetRemoteAuthenticatedKey( PGPsecshSessionRef ref, + PGPKeyDBObjRef *outKey, + PGPKeyDBRef * outKeyDB ); + +/*____________________________________________________________________________ + The following function exports a PGP key in SECSH format. The resulting + line can be copied into the SECSH host file. inKey is the key to + export, and inUserName is the name which is put at the end of the line, + which is used only as a convenient label by SECSH software. + The data is returned in a null-terminated allocated buffer which the + caller should free. +____________________________________________________________________________*/ + PGPError +PGPsecshExportPublicKey( + PGPKeyDBObjRef inKey, + char * inUserName, + char ** outBuffer, + PGPSize * outLength); + +/*____________________________________________________________________________ + The following two functions process data through SECSH. + + It is an error to call these functions without having set a + Read function pointer or Write function pointer. +____________________________________________________________________________*/ +PGPError PGPsecshReceive( PGPsecshSessionRef ref, + PGPByte * outType, + void ** outBuffer, + PGPSize * bufferSize ); + +PGPError PGPsecshSend( PGPsecshSessionRef ref, + PGPByte pktType, + const void * inBuffer, + PGPSize inBufferLength ); + +/*____________________________________________________________________________ + The following two functions set the callbacks which do the actual I/O. + + The inData parameter is passed to the callback and may be e.g. a socket + handle. +____________________________________________________________________________*/ +PGPError PGPsecshSetReceiveCallback( PGPsecshSessionRef ref, + PGPsecshReceiveProcPtr secshReceiveProc, + void * inData ); + +PGPError PGPsecshSetSendCallback( PGPsecshSessionRef ref, + PGPsecshSendProcPtr secshSendProc, + void * inData ); + + +/*____________________________________________________________________________ + The following function is necessary *only* on a non-blocking socket. + If a call to PGPsecshSend returns kPGPError_SECSHWouldBlock, call + the following function repeatedly until that error is no longer + returned in order to make sure data is sent. Another call to + PGPsecshSend will also call this function automatically and queue + any new data if necessary. +____________________________________________________________________________*/ +PGPError PGPsecshSendQueueIdle( PGPsecshSessionRef ref ); + +PGPSize PGPsecshReceiveBufferSize( PGPsecshSessionRef ref ); + +/*____________________________________________________________________________ + The following function gets the ID of the fatal alert which caused + the SECSH session to abort and go into the kPGPsecsh_FatalErrorState. +____________________________________________________________________________*/ +PGPError PGPsecshGetAlert( PGPsecshSessionRef ref, PGPsecshAlert *outAlert ); + + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_PGPsecsh_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSKEP.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSKEP.h new file mode 100644 index 0000000000..217c88e1b8 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSKEP.h @@ -0,0 +1,120 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpSKEP.h,v 1.1 2004/04/01 11:45:40 wprice Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpSKEP_h /* [ */ +#define Included_pgpSKEP_h + +#include "pgpConfig.h" +#include "pgpBase.h" +#include "pgpErrors.h" +#include "pgpShare.h" +#include "pgpKeys.h" +#include "pgpTLS.h" + +typedef struct PGPskep * PGPskepRef; + +#define kInvalidPGPskepRef ((PGPskepRef) NULL) +#define PGPskepRefIsValid( ref ) ( (ref) != kInvalidPGPskepRef ) + +typedef enum _PGPskepEventType +{ + kPGPskepEvent_NullEvent = 0, /* Nothing is happening */ + kPGPskepEvent_ListenEvent = 1, /* Listening for data */ + kPGPskepEvent_ConnectEvent = 2, /* Connection established */ + kPGPskepEvent_AuthenticateEvent = 3, /* Remote site authenticated */ + kPGPskepEvent_ProgressEvent = 4, /* Data flow progress */ + kPGPskepEvent_CloseEvent = 5, /* Connection closing */ + kPGPskepEvent_ShareEvent = 6, /* Share received */ + kPGPskepEvent_PassphraseEvent = 7 /* Passphrase needed */ +} PGPskepEventType; + +typedef struct _PGPskepEventAuthenticateData +{ + PGPKeyDBObjRef remoteKey; + const char * remoteHostname; + const char * remoteIPAddress; + PGPtlsCipherSuiteNum tlsCipher; +} PGPskepEventAuthenticateData; + +typedef struct _PGPskepEventProgressData +{ + PGPUInt32 bytesSoFar; + PGPUInt32 bytesTotal; +} PGPskepEventProgressData; + +typedef struct _PGPskepEventShareData +{ + PGPShareRef shares; +} PGPskepEventShareData; + +typedef struct _PGPskepEventPassphraseData +{ + char * passphrase; + PGPByte * passkey; + PGPSize passkeySize; +} PGPskepEventPassphraseData; + +typedef union _PGPskepEventData +{ + PGPskepEventAuthenticateData ad; + PGPskepEventProgressData pd; + PGPskepEventShareData sd; + PGPskepEventPassphraseData ppd; +} PGPskepEventData; + +typedef struct _PGPskepEvent +{ + PGPskepEventType type; + PGPskepEventData data; +} PGPskepEvent; + +typedef PGPError (*PGPskepEventHandler)(PGPskepRef skep, + PGPskepEvent *event, PGPUserValue userValue); + + +PGP_BEGIN_C_DECLARATIONS + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +PGPError PGPNewSKEP(PGPContextRef context, + PGPtlsContextRef tlsContext, + PGPskepRef *skep); + +PGPError PGPskepSetEventHandler(PGPskepRef skep, + PGPskepEventHandler handler, PGPUserValue userValue); + +PGPError PGPskepSendShares(PGPskepRef skep, PGPKeyDBObjRef authKey, + const char *passphrase, PGPShareRef shares, + const char *destSocketAddress); + +PGPError PGPskepReceiveShares(PGPskepRef skep, PGPKeyDBObjRef authKey, + const char *passphrase); + +PGPError PGPskepCancel(PGPskepRef skep); + +PGPError PGPFreeSKEP(PGPskepRef skep); + +PGPContextRef PGPGetSKEPContext(PGPskepRef skep); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpSKEP_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpShare.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpShare.h new file mode 100644 index 0000000000..04d6da569c --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpShare.h @@ -0,0 +1,80 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpShare.h,v 1.1 2004/04/01 11:45:40 wprice Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpShare_h /* [ */ +#define Included_pgpShare_h + +#include "pgpConfig.h" +#include "pgpBase.h" +#include "pgpKeys.h" + +typedef struct PGPShare * PGPShareRef; + +typedef struct PGPShareID_ +{ + PGPByte data[8]; +} PGPShareID; + +#define kInvalidPGPShareRef ((PGPShareRef) NULL) +#define PGPShareRefIsValid( ref ) ( (ref) != kInvalidPGPShareRef ) + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +PGPError PGPCreateShares(PGPContextRef context, PGPKeyDBObjRef key, + PGPUInt32 threshold, PGPUInt32 numShares, + PGPShareRef *share); + +/* The passkey needs to be freed with PGPFreeData(passkey) */ +PGPError PGPGetPasskeyFromShares(PGPShareRef share, PGPByte **passkey, + PGPSize *passkeySize); + +PGPError PGPSplitShares(PGPShareRef share, PGPUInt32 numShares, + PGPShareRef *splitShares); + +/* The share objects being combined are NOT freed by this function */ +PGPError PGPCombineShares(PGPShareRef firstShare, PGPShareRef secondShare, + PGPShareRef *combinedShares); + +PGPError PGPFreeShares(PGPShareRef share); + +PGPError PGPGetKeyIDFromShares(PGPShareRef share, PGPKeyID *id); + +PGPError PGPGetShareID(PGPShareRef share, PGPShareID *id); + +PGPUInt32 PGPGetShareThreshold(PGPShareRef share); + +/* This is the number of shares contained in the share object */ +PGPUInt32 PGPGetNumberOfShares(PGPShareRef share); + +/* The share object may contain less than the total number of shares */ +PGPUInt32 PGPGetTotalNumberOfShares(PGPShareRef share); + +PGPBoolean IsSamePGPShares(PGPShareRef firstShare, PGPShareRef secondShare); + +/* If firstID < secondID, -1 */ +/* If firstID > secondID, 1 */ +/* If firstID = secondID, 0 */ +PGPInt32 PGPCompareShareIDs(PGPShareID firstID, PGPShareID secondID); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpShare_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpShareFile.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpShareFile.h new file mode 100644 index 0000000000..4a7aa3e920 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpShareFile.h @@ -0,0 +1,95 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpShareFile.h,v 1.1 2004/04/01 11:45:40 wprice Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpShareFile_h /* [ */ +#define Included_pgpShareFile_h + +#include "pgpConfig.h" +#include "pgpBase.h" +#include "pgpErrors.h" +#include "pgpPubTypes.h" +#include "pflTypes.h" +#include "pgpShare.h" + +typedef struct PGPShareFile * PGPShareFileRef; + +#define kInvalidPGPShareFileRef ((PGPShareFileRef) NULL) +#define PGPShareFileRefIsValid( ref ) ( (ref) != kInvalidPGPShareFileRef ) + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +PGPError PGPNewShareFile(PFLFileSpecRef shareFileSpec, + PGPShareFileRef *shareFileRef); + +PGPError PGPFreeShareFile(PGPShareFileRef shareFileRef); + +/* The share object needs to be freed with PGPFreeShares(shares) */ +PGPError PGPCopySharesFromFile(PGPContextRef context, + PGPShareFileRef shareFileRef, PGPOptionListRef optionList, + PGPShareRef *shares); + +PGPError PGPCopySharesToFile(PGPContextRef context, + PGPShareFileRef shareFileRef, PGPOptionListRef optionList, + PGPShareRef shares); + +PGPError PGPGetShareFileUserID(PGPShareFileRef shareFileRef, + PGPSize bufferSize, PGPUTF8 *userID, PGPSize *fullSize); + +PGPError PGPSetShareFileUserID(PGPShareFileRef shareFileRef, + const PGPUTF8 *userID); + +PGPError PGPOpenShareFile(PFLFileSpecRef shareFileSpec, + PGPShareFileRef *shareFileRef); + +PGPError PGPSaveShareFile(PGPShareFileRef shareFileRef); + +PGPError PGPGetShareFileSpec(PGPShareFileRef shareFileRef, + PFLFileSpecRef *shareFileSpec); + +PGPError PGPGetShareFileShareID(PGPShareFileRef shareFileRef, + PGPShareID *id); + +PGPError PGPGetShareFileOwnerKeyID(PGPShareFileRef shareFileRef, + PGPKeyID *id); + +PGPError PGPSetShareFileOwnerKeyID(PGPShareFileRef shareFileRef, + const PGPKeyID id); + +PGPError PGPGetShareFileOwnerFingerprint(PGPShareFileRef shareFileRef, + PGPSize bufferSize, void *fingerprint, PGPSize *fullSize); + +PGPError PGPSetShareFileOwnerFingerprint(PGPShareFileRef shareFileRef, + PGPSize bufferSize, const void *fingerprint); + +PGPError PGPGetShareFileSharedKeyID(PGPShareFileRef shareFileRef, + PGPKeyID *id); + +PGPUInt32 PGPGetShareThresholdInFile(PGPShareFileRef shareFileRef); + +PGPUInt32 PGPGetNumSharesInFile(PGPShareFileRef shareFileRef); + +PGPBoolean IsSamePGPSharesInFiles(PGPShareFileRef firstFile, + PGPShareFileRef secondFile); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpShareFile_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSockets.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSockets.h new file mode 100644 index 0000000000..e82ab45026 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSockets.h @@ -0,0 +1,464 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpSockets.h,v 1.8 2003/12/13 01:20:39 dallen Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpSockets_h /* [ */ +#define Included_pgpSockets_h + +#include <stdio.h> + +#include "pgpOptionList.h" +#include "pgpTLS.h" +#include "pgpErrors.h" + +#if PGP_UNIX +# include <sys/types.h> +# include <sys/socket.h> +# include <sys/time.h> /* Needed for struct timeval */ +#if PGP_UNIX_LINUX +# include <sys/ioctl.h> /* Need FIONREAD */ +#elif PGP_UNIX_SOLARIS || PGP_UNIX_DARWIN +# include <sys/filio.h> +#elif PGP_UNIX_AIX +#include <sys/ioctl.h> +#endif /* ! PGP_UNIX_LINUX */ +# include <netinet/in.h> +# include <netdb.h> +#endif + +#if PGP_WIN32 +# include <winsock.h> +#endif + +PGP_BEGIN_C_DECLARATIONS + +#if PGP_UNIX +typedef int PGPSocketRef; +#else +typedef SOCKET PGPSocketRef; +#endif + + +/* + * Unix and Windows share the same Berkeley socket interface. This isn't + * the most efficient Windows implmentation of TCP/IP, but it is + * compatible with UNIX berkeley sockets, making cross-platform possible. + * + * Trying to write cross-platform win32 TCP/IP code using all the fancy + * dancy Win32 network functions would be nearly impossible IMHO + * + * The Mac doesn't have the berkeley stuff, so we roll our own for all + * of the structures. + * + * Start with Unix and Win32 + */ +#if PGP_UNIX || PGP_WIN32 + +# define kInvalidPGPSocketRef ((PGPSocketRef) (~0)) + + typedef struct hostent PGPHostEntry; + typedef struct protoent PGPProtocolEntry; + typedef struct servent PGPServiceEntry; + typedef struct sockaddr_in PGPSocketAddressInternet; + typedef struct sockaddr PGPSocketAddress; + typedef struct in_addr PGPInternetAddress; + typedef fd_set PGPSocketSet; + typedef struct timeval PGPSocketsTimeValue; + +# define PGPSOCKETSET_CLEAR(socketRef, set) FD_CLR((int) (socketRef), (set)) +# define PGPSOCKETSET_SET(socketRef, set) FD_SET((int) (socketRef), (set)) +# define PGPSOCKETSET_ZERO(set) FD_ZERO((set)) +# define PGPSOCKETSET_ISSET(socketRef, set) FD_ISSET((int) (socketRef), (set)) + + /* Address families */ + enum { + kPGPAddressFamilyUnspecified = AF_UNSPEC, + kPGPAddressFamilyInternet = AF_INET + }; + + /* Protocol families */ + enum { + kPGPProtocolFamilyInternet = PF_INET + }; + + /* Types */ + enum { + kPGPSocketTypeStream = SOCK_STREAM, + kPGPSocketTypeDatagram = SOCK_DGRAM + }; + + /* Commands for PGPIOControlSocket */ + enum { + kPGPSocketCommandGetUnreadData = FIONREAD + }; + + /* Levels for PGPGetSocketOptions and PGPSetSocketOptions */ + enum { + kPGPSocketOptionLevelSocket = SOL_SOCKET + }; + + /* Options for PGPGetSocketOptions and PGPSetSocketOptions */ + enum { + kPGPSocketOptionAcceptingConnections = SO_ACCEPTCONN, + kPGPSocketOptionType = SO_TYPE + }; + + /* Protocols */ + enum { + kPGPTCPProtocol = IPPROTO_TCP, + kPGPUDPProtocol = IPPROTO_UDP + }; + + /* Send flags */ + enum { + kPGPSendFlagNone = 0 + }; + + /* Receive flags */ + enum { + kPGPReceiveFlagNone = 0 + }; + + /* Internet Addresses */ + enum { + kPGPInternetAddressAny = INADDR_ANY + }; + +#endif /* PGP_UNIX || PGP_WIN32 */ + +/* + * Onto the Mac, where we need to create our own versions of the various + * structures. + */ +#if PGP_MACINTOSH + +# define kInvalidPGPSocketRef ((PGPSocketRef) NULL) + + typedef struct PGPInternetAddress { + union { + struct { + PGPByte s_b1; + PGPByte s_b2; + PGPByte s_b3; + PGPByte s_b4; + } S_un_b; + struct { + PGPUInt16 s_w1; + PGPUInt16 s_w2; + } S_un_w; + PGPUInt32 S_addr; + } S_un; +# define s_addr S_un.S_addr + } PGPInternetAddress; + + typedef struct PGPSocketAddressInternet { + PGPInt16 sin_family; + PGPUInt16 sin_port; + PGPInternetAddress sin_addr; + PGPByte sin_zero[8]; + } PGPSocketAddressInternet; + + typedef struct PGPSocketAddress { + PGPUInt16 sa_family; + PGPByte sa_data[14]; + } PGPSocketAddress; + + typedef struct PGPHostEntry { + char * h_name; + char ** unused; + PGPInt16 h_addrtype; + PGPInt16 h_length; + char ** h_addr_list; +# define h_addr h_addr_list[0] + } PGPHostEntry; + + typedef struct PGPProtocolEntry { + char * p_name; + char ** p_aliases; + PGPInt16 p_proto; + } PGPProtocolEntry; + + typedef struct PGPServiceEntry { + char * s_name; + char ** s_aliases; + PGPUInt16 s_port; + char * s_proto; + } PGPServiceEntry; + + /* Select types and defines */ +# ifndef PGPSOCKETSET_SETSIZE +# define PGPSOCKETSET_SETSIZE 64 +# endif + + typedef struct PGPSocketSet { + PGPUInt16 fd_count; + PGPSocketRef fd_array[PGPSOCKETSET_SETSIZE]; + } PGPSocketSet; + +# define PGPSOCKETSET_CLEAR(socketRef, set) do { \ + PGPUInt16 __i; \ + for (__i = 0; __i < ((PGPSocketSet * (set))->fd_count; __i++) { \ + if (((PGPSocketSet *) (set))->fd_array[__i] == socketRef) { \ + while (__i < (((PGPSocketSet *) (set))->fd_count - 1)) { \ + ((PGPSocketSet *) (set))->fd_array[__i] = \ + ((PGPSocketSet *) (set))->fd_array[__i + 1]; \ + __i++; \ + } \ + ((PGPSocketSet *) (set))->fd_count--; \ + break; \ + } \ + } \ + } while (0) + +# define PGPSOCKETSET_SET(socketRef, set) do { \ + if (((PGPSocketSet *) (set))->fd_count < PGPSOCKETSET_SETSIZE) { \ + ((PGPSocketSet *) (set))->fd_array[((PGPSocketSet *) \ + (set))->fd_count++] = (socketRef); \ + } \ + } while (0) + +# define PGPSOCKETSET_ZERO(set) (((PGPSocketSet *) (set))->fd_count = 0) + + PGPInt32 __PGPSocketsIsSet(PGPSocketRef, PGPSocketSet *); + +# define PGPSOCKETSET_ISSET(socketRef, set) __PGPSocketsIsSet( \ + (socketRef),(set)) + + typedef struct PGPSocketsTimeValue { + PGPInt32 tv_sec; /* seconds */ + PGPInt32 tv_usec; /* and microseconds */ + } PGPSocketsTimeValue; + + /* Address families */ + enum { + kPGPAddressFamilyUnspecified = 0, + kPGPAddressFamilyInternet = 2 + }; + + /* Protocol families */ + enum { + kPGPProtocolFamilyInternet = kPGPAddressFamilyInternet + }; + + /* Types */ + enum { + kPGPSocketTypeStream = 1, + kPGPSocketTypeDatagram = 2 + }; + + /* Commands for PGPIOControlSocket */ + enum { + kPGPSocketCommandGetUnreadData = (0x40000000 + | (((long) sizeof(PGPUInt32) & 0x7F) << 16) | ('f' << 8) | 127) + }; + + /* Levels for PGPGetSocketOptions and PGPSetSocketOptions */ + enum { + kPGPSocketOptionLevelSocket = 0xFFFFFFFF + }; + + /* Options for PGPGetSocketOptions and PGPSetSocketOptions */ + enum { + kPGPSocketOptionAcceptingConnections = 0x00000002, + kPGPSocketOptionType = 0x00001008 + }; + + /* Protocols */ + enum { + kPGPTCPProtocol = 6, + kPGPUDPProtocol = 17 + }; + + /* Send flags */ + enum { + kPGPSendFlagNone = 0 + }; + + /* Receive flags */ + enum { + kPGPReceiveFlagNone = 0 + }; + + /* Internet Addresses */ + enum { + kPGPInternetAddressAny = 0x00000000 + }; + +#endif /* PGP_MACINTOSH */ + +/* + * Some global things for all platforms + */ + +#define PGPSocketRefIsValid(ref) ((ref) != kInvalidPGPSocketRef) + +typedef struct PGPSocketsThreadStorage * PGPSocketsThreadStorageRef; +# define kInvalidPGPSocketsThreadStorageRef \ + ((PGPSocketsThreadStorageRef) NULL) +#define PGPSocketsThreadStorageRefIsValid(ref) \ + ((ref) != kInvalidPGPSocketsThreadStorageRef) + +extern PGPSocketAddressInternet kPGPAddressAny; + +/* Errors */ +#define kPGPSockets_Error -1 + +/* Net byte ordering macros (PGP_WORDSBIGENDIAN defined by configure) */ +#if PGP_WORDSBIGENDIAN +# define PGPHostToNetLong(x) (x) +# define PGPHostToNetShort(x) (x) +# define PGPNetToHostLong(x) (x) +# define PGPNetToHostShort(x) (x) +#else + PGPInt32 PGPHostToNetLong(PGPInt32 x); + PGPInt16 PGPHostToNetShort(PGPInt16 x); + PGPInt32 PGPNetToHostLong(PGPInt32 x); + PGPInt16 PGPNetToHostShort(PGPInt16 x); +#endif /* PGP_WORDSBIGENDIAN */ + +/* + * Shared function interface (except for idle handler code) + */ + +/* + * Use the idle event handler to receive periodic idle events during + * network calls. Usually this is used only in non-preemptive multi-tasking + * OSes to allow yielding in threads. Pre-emptive multi-tasking systems + * should probably not use the call as it interrupts the efficient wait state + * of threads waiting on network calls. + * + * Idle event handlers need to be added on a per thread basis. + * + * Returning an error from the idle event handler will cause the socket + * that is blocking to close. + * + */ +PGPError PGPSetSocketsIdleEventHandler( + PGPEventHandlerProcPtr inCallback, + PGPUserValue inUserData); + +PGPError PGPGetSocketsIdleEventHandler( + PGPEventHandlerProcPtr * outCallback, + PGPUserValue * outUserData); + +/* Static storage creation */ +PGPError PGPSocketsCreateThreadStorage( + PGPSocketsThreadStorageRef * outPreviousStorage); +PGPError PGPSocketsDisposeThreadStorage( + PGPSocketsThreadStorageRef inPreviousStorage); + +/* Stack based class for saving and restoring thread storage */ +#ifdef __cplusplus /* [ */ +class StPGPPreserveSocketsStorage { +public: + StPGPPreserveSocketsStorage() : mStorage(NULL) + { PGPSocketsCreateThreadStorage(&mStorage); } + ~StPGPPreserveSocketsStorage() + { PGPSocketsDisposeThreadStorage(mStorage); } + +protected: + PGPSocketsThreadStorageRef mStorage; +}; +#endif /* ] __cplusplus */ + + +/* Initialization and termination */ +PGPError PGPSocketsInit(void); +void PGPSocketsCleanup(void); + +/* Socket creation and destruction */ +PGPSocketRef PGPOpenSocket(PGPInt32 inAddressFamily, PGPInt32 inSocketType, + PGPInt32 inSocketProtocol); +PGPInt32 PGPCloseSocket(PGPSocketRef inSocketRef); + +/* Endpoint binding */ +PGPInt32 PGPBindSocket(PGPSocketRef inSocketRef, + const PGPSocketAddress * inAddress, + PGPInt32 inAddressLength); +PGPInt32 PGPConnect(PGPSocketRef inSocketRef, + const PGPSocketAddress * inServerAddress, + PGPInt32 inAddressLength); + +/* Send functions */ +PGPInt32 PGPSend(PGPSocketRef inSocketRef, const void * inBuffer, + PGPInt32 inBufferLength, PGPInt32 inFlags); +PGPInt32 PGPWrite(PGPSocketRef inSocketRef, const void * inBuffer, + PGPInt32 inBufferLength); +PGPInt32 PGPSendTo(PGPSocketRef inSocketRef, const void * inBuffer, + PGPInt32 inBufferLength, PGPInt32 inFlags, + PGPSocketAddress * inAddress, + PGPInt32 inAddressLength); + +/* Receive functions */ +PGPInt32 PGPReceive(PGPSocketRef inSocketRef, void * outBuffer, + PGPInt32 inBufferSize, PGPInt32 inFlags); +PGPInt32 PGPRead(PGPSocketRef inSocketRef, void * outBuffer, + PGPInt32 inBufferSize); +PGPInt32 PGPReceiveFrom(PGPSocketRef inSocketRef, void * outBuffer, + PGPInt32 inBufferSize, PGPInt32 inFlags, + PGPSocketAddress * outAddress, + PGPInt32 * ioAddressLength); + +/* Server functions */ +PGPInt32 PGPListen(PGPSocketRef inSocketRef, PGPInt32 inMaxBacklog); +PGPSocketRef PGPAccept(PGPSocketRef inSocketRef, + PGPSocketAddress * outAddress, + PGPInt32 * ioAddressLength); + +/* Select */ +/* Note that inNumSetCount is not used under Mac and Windows */ +PGPInt32 PGPSelect(PGPInt32 inNumSetCount, + PGPSocketSet * ioReadSet, + PGPSocketSet * ioWriteSet, + PGPSocketSet * ioErrorSet, + const PGPSocketsTimeValue * inTimeout); + +/* DNS and protocol services */ +PGPHostEntry * PGPGetHostByName(const PGPChar8 * inName); +PGPHostEntry * PGPGetHostByAddress(const PGPChar8 * inAddress, + PGPInt32 inLength, + PGPInt32 inType); +PGPInt32 PGPGetHostName(PGPChar8 * outName, PGPInt32 inNameLength); +PGPProtocolEntry * PGPGetProtocolByName(const PGPChar8 * inName); +PGPProtocolEntry * PGPGetProtocolByNumber(PGPInt32 inNumber); +PGPServiceEntry * PGPGetServiceByName(const PGPChar8 * inName, + const PGPChar8 * inProtocol); +PGPServiceEntry * PGPGetServiceByPort(PGPInt32 inPort, + const PGPChar8 * inProtocol); + +/* Error reporting */ +PGPError PGPGetLastSocketsError(void); + +/* Utilities */ +PGPInt32 PGPGetSocketName(PGPSocketRef inSocketRef, + PGPSocketAddress * outName, + PGPInt32 * ioNameLength); +PGPInt32 PGPGetPeerName(PGPSocketRef inSocketRef, + PGPSocketAddress * outName, + PGPInt32 * ioNameLength); +PGPUInt32 PGPDottedToInternetAddress(const PGPChar8 * inAddress); +PGPChar8 * PGPInternetAddressToDottedString(PGPInternetAddress inAddress); + +/* Control and options */ +PGPInt32 PGPIOControlSocket(PGPSocketRef inSocketRef, + PGPInt32 inCommand, PGPUInt32 * ioParam); +PGPInt32 PGPGetSocketOptions(PGPSocketRef inSocketRef, PGPInt32 inLevel, + PGPInt32 inOptionName, + PGPChar8 * outOptionValue, + PGPInt32 * ioOptionLength); +PGPInt32 PGPSetSocketOptions(PGPSocketRef inSocketRef, PGPInt32 inLevel, + PGPInt32 inOptionName, + const PGPChar8 * inOptionValue, + PGPInt32 inOptionLength); + +/* TLS */ +PGPError PGPSocketsEstablishTLSSession(PGPSocketRef inSocketRef, + PGPtlsSessionRef inTLSSession); + + +PGP_END_C_DECLARATIONS + +#endif /* Included_pgpSockets_h */ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSymmetricCipher.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSymmetricCipher.h new file mode 100644 index 0000000000..61a700e33e --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpSymmetricCipher.h @@ -0,0 +1,114 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpSymmetricCipher.h,v 1.7 2003/10/07 01:29:44 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpSymmetricCipher_h /* [ */ +#define Included_pgpSymmetricCipher_h + +#include "pgpPubTypes.h" + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + Create a new cipher of the specified algorithm. The cipher cannot be used + until PGPInitSymmetricCipher() has been called. + + If the algorithm is not available then kPGPError_AlgorithmNotAvailable is + returned. +____________________________________________________________________________*/ + +PGPError PGPNewSymmetricCipherContext( PGPContextRef context, + PGPCipherAlgorithm algorithm, + PGPSymmetricCipherContextRef *outRef ); + +/*____________________________________________________________________________ + Disposal clears all data in memory before releasing it. +____________________________________________________________________________*/ + +PGPError PGPFreeSymmetricCipherContext( PGPSymmetricCipherContextRef ref ); + +/*____________________________________________________________________________ + Make an exact copy of the cipher, including the key. +____________________________________________________________________________*/ + +PGPError PGPCopySymmetricCipherContext( PGPSymmetricCipherContextRef ref, + PGPSymmetricCipherContextRef *outRef ); + +/*____________________________________________________________________________ + The key must be set before using; a cipher can be repeatedly reset and + reused with different keys to avoid having to create and destroy new + contexts each time (and it's also cryptographically better not to reuse + a key). + Key size is implicit based on algorithm. 'key' is *copied*. Caller + may want to destroy the original after passing it in. +____________________________________________________________________________*/ + +PGPError PGPInitSymmetricCipher( PGPSymmetricCipherContextRef ref, + const void *key ); + +/*____________________________________________________________________________ + Wipe any sensitive data in the cipher. Cipher remains alive, but + key must be set before any data is encrypted. +____________________________________________________________________________*/ + +PGPError PGPWipeSymmetricCipher( PGPSymmetricCipherContextRef ref ); + +/*____________________________________________________________________________ + "Wash" the symmetric cipher +____________________________________________________________________________*/ + +PGPError PGPWashSymmetricCipher( PGPSymmetricCipherContextRef ref, + void const *buf, PGPSize len); + +/*____________________________________________________________________________ + Encrypt or decrypt one "block" of data. The block size is determined + by the cipher (see PGPGetSymmetricCipherSizes()). +____________________________________________________________________________*/ + +PGPError PGPSymmetricCipherEncrypt( PGPSymmetricCipherContextRef ref, + const void *in, void *out ); + +PGPError PGPSymmetricCipherDecrypt( PGPSymmetricCipherContextRef ref, + const void *in, void *out ); + +/*____________________________________________________________________________ + Determine key and block size for specified algorithm. Stateless routine + does not need a context. +____________________________________________________________________________*/ +PGPError PGPGetSymmetricCipherSizes( PGPSymmetricCipherContextRef ref, + PGPSize *keySize, PGPSize *blockSize ); + +/*____________________________________________________________________________ + * This function integrates stream ciphers into framework of block API. + * To encrypt/decrypt data, the caller works with stream cipher in ECB block + * mode and calls this function before and after the last block. + * There is a feedback between the previous block and the current + * block for stream ciphers, so ECB for stream ciphers is similiar to CBC + * with fixed IV for block ciphers. + * + * To indicate the real size of input data the caller must call this function + * with 'size'=0xffffffff before the last block to save a state and then + * call this function again after the last block was encrypted/decrypted + * with the 'size' set to the real number of bytes in the buffer. This + * operation is similiar to padding for block ciphers. +____________________________________________________________________________*/ +PGPError PGPSymmetricCipherRollback( PGPSymmetricCipherContextRef ref, + PGPSize size ); + + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpSymmetricCipher_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpTLS.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpTLS.h new file mode 100644 index 0000000000..f901b1b0db --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpTLS.h @@ -0,0 +1,336 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + $Id: pgpTLS.h,v 1.13 2004/04/06 05:00:58 wprice Exp $ +____________________________________________________________________________*/ +#ifndef Included_PGPtls_h /* [ */ +#define Included_PGPtls_h + +#include "pgpPubTypes.h" + +PGP_BEGIN_C_DECLARATIONS + + +typedef struct PGPtlsContext * PGPtlsContextRef; +typedef const struct PGPtlsContext * PGPtlsConstContextRef; + +#define kInvalidPGPtlsContextRef ((PGPtlsContextRef) NULL) +#define PGPtlsContextRefIsValid( ref ) ( (ref) != kInvalidPGPtlsContextRef ) + +typedef struct PGPtlsSession * PGPtlsSessionRef; +typedef const struct PGPtlsSession * PGPtlsConstSessionRef; + +#define kInvalidPGPtlsSessionRef ((PGPtlsSessionRef) NULL) +#define PGPtlsSessionRefIsValid( ref ) ( (ref) != kInvalidPGPtlsSessionRef ) + + +typedef PGPFlags PGPtlsFlags; +#define kPGPtlsFlags_ServerSide 0x01 +#define kPGPtlsFlags_ClientSide 0x02 +#define kPGPtlsFlags_RequestClientCert 0x04 +#define kPGPtlsFlags_NonBlockingIO 0x08 + +enum PGPtlsCipherSuiteNum_ +{ + kPGPtls_TLS_NULL_WITH_NULL_NULL = 0, + kPGPtls_TLS_PGP_DHE_DSS_WITH_CAST_CBC_SHA = 1, + kPGPtls_TLS_PGP_DHE_RSA_WITH_CAST_CBC_SHA = 2, + kPGPtls_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 3, + kPGPtls_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 4, + kPGPtls_TLS_RSA_WITH_3DES_EDE_CBC_SHA = 5, + kPGPtls_TLS_RSA_WITH_IDEA_CBC_SHA = 6, + kPGPtls_TLS_PGP_RSA_WITH_CAST_CBC_SHA = 7, + kPGPtls_TLS_PGP_DHE_DSS_WITH_NULL_SHA = 8, + kPGPtls_TLS_DHE_DSS_WITH_NULL_SHA = 9, + kPGPtls_TLS_RSA_WITH_ARC4_128_SHA = 10, + + kPGPtls_TLS_RSA_WITH_AES_128_CBC_SHA = 11, + kPGPtls_TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 12, + kPGPtls_TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 13, + + kPGPtls_TLS_RSA_WITH_AES_256_CBC_SHA = 15, + kPGPtls_TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 16, + kPGPtls_TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 17, + + PGP_ENUM_FORCE( PGPtlsCipherSuiteNum_ ) +}; +PGPENUM_TYPEDEF( PGPtlsCipherSuiteNum_, PGPtlsCipherSuiteNum ); + +enum PGPtlsProtocolState_ +{ + kPGPtls_IdleState = 0, + kPGPtls_FatalErrorState = 1, + kPGPtls_ClosedState = 2, + kPGPtls_HandshakeState = 3, + kPGPtls_ReadyState = 4, + + PGP_ENUM_FORCE( PGPtlsProtocolState_ ) +}; +PGPENUM_TYPEDEF( PGPtlsProtocolState_, PGPtlsProtocolState ); + +enum PGPtlsPrime_ +{ + kPGPtls_DHPrime1024 = 0, + kPGPtls_DHPrime1536 = 1, + kPGPtls_DHPrime2048 = 2, + kPGPtls_DHPrime3072 = 3, + kPGPtls_DHPrime4096 = 4, + + PGP_ENUM_FORCE( PGPtlsPrime_ ) +}; +PGPENUM_TYPEDEF( PGPtlsPrime_, PGPtlsPrime ); + +enum PGPtlsAlert_ +{ + kPGPtls_AT_CloseNotify = 0, + kPGPtls_AT_UnexpectedMessage = 10, /* FATAL */ + kPGPtls_AT_BadRecordMAC = 20, /* FATAL */ + kPGPtls_AT_DecryptionFailed = 21, /* FATAL */ + kPGPtls_AT_RecordOverflow = 22, /* FATAL */ + kPGPtls_AT_DecompressionFailure = 30, /* FATAL */ + kPGPtls_AT_HandshakeFailure = 40, /* FATAL */ + kPGPtls_AT_NoCertificate = 41, /* SSL3 */ + kPGPtls_AT_BadCertificate = 42, + kPGPtls_AT_UnsupportedCert = 43, + kPGPtls_AT_CertRevoked = 44, + kPGPtls_AT_CertExpired = 45, + kPGPtls_AT_CertUnknown = 46, + kPGPtls_AT_IllegalParameter = 47, /* FATAL */ + kPGPtls_AT_UnknownCA = 48, /* FATAL */ + kPGPtls_AT_AccessDenied = 49, /* FATAL */ + kPGPtls_AT_DecodeError = 50, /* FATAL */ + kPGPtls_AT_DecryptError = 51, + kPGPtls_AT_ExportRestriction = 60, /* FATAL */ + kPGPtls_AT_ProtocolVersion = 70, /* FATAL */ + kPGPtls_AT_InsufficientSecurity = 71, /* FATAL */ + kPGPtls_AT_InternalError = 80, /* FATAL */ + kPGPtls_AT_UserCancelled = 90, + kPGPtls_AT_NoRenegotiation = 100, + + kPGPtls_AT_None = 255, + + PGP_ENUM_FORCE( PGPtlsAlert_ ) +}; +PGPENUM_TYPEDEF( PGPtlsAlert_, PGPtlsAlert ); + +/* The Send and Receive function pointers should return + kPGPError_TLSWouldBlock when the socket is non-blocking and the + call would block. The Send and Receive functions passed in will + need to translate the platform-specific socket error in appropriate + cases by using calls such as WSAGetLastError() on Win32. Remember + to call PGPtlsSendQueueIdle for non-blocking sockets also if + kPGPError_TLSWouldBlock is returned from a send on a non-blocking + socket. */ + +typedef PGPInt32 (* PGPtlsReceiveProcPtr)(void *inData, void *outBuffer, + PGPInt32 outBufferSize); +typedef PGPInt32 (* PGPtlsSendProcPtr)(void *inData, const void *inBuffer, + PGPInt32 inBufferLength); +typedef PGPInt32 (* PGPtlsPeekProcPtr)(void *inData, void *outBuffer, + PGPInt32 outBufferSize); + +PGPError PGPNewTLSContext( PGPContextRef context, + PGPtlsContextRef *outRef ); + +PGPError PGPFreeTLSContext( PGPtlsContextRef ref ); + +/*____________________________________________________________________________ + The following function activates or deactivates the session key cache + for TLS sessions. This defaults to on but can be deactivated with this + function to force all connections to proceed through the entire + handshake. +____________________________________________________________________________*/ +PGPError PGPtlsSetCache( PGPtlsContextRef ref, PGPBoolean useCache ); + +PGPError PGPtlsClearCache( PGPtlsContextRef ref ); + +PGPError PGPNewTLSSession( PGPtlsContextRef ref, PGPtlsSessionRef *outRef ); + +PGPError PGPFreeTLSSession( PGPtlsSessionRef ref ); + +PGPError PGPCopyTLSSession( PGPtlsSessionRef ref, PGPtlsSessionRef *outRef ); + +/* Default options are client side and no client cert request */ +PGPError PGPtlsSetProtocolOptions( PGPtlsSessionRef ref, + PGPtlsFlags options ); + + +/*____________________________________________________________________________ + The following function must be called to cleanly close a TLS + connection. If it is not called, the session will not be able + to be resumed from the session cache. + + In the event the application determines any problem with the + connection such as the remote key not being valid, call this + function with dontCache set to true in order to not cache the + session keys. +____________________________________________________________________________*/ +PGPError PGPtlsClose( PGPtlsSessionRef ref, + PGPBoolean dontCache ); + +/*____________________________________________________________________________ + The following function must be called to identify cached TLS session. + + During a handshake resulting in reused TLS sessions no certificate exchange + is taking place, so certificate or certificate chain cannot be queried by + a call to PGPtlsGetRemoteAuthenticatedKey(). Remote peer's authentication + keys are assumed to be authorized by the application when it earlier placed + a session into a cache by calling PGPtlsClose(session, FALSE), so the "TRUE" + return value means "already authorized session". + + There is no need to call this function if no caching is done, for example, + if PGPtlsClose(session, FALSE) is never called or cache is + disabled / cleared in PGPtlsContextRef. +____________________________________________________________________________*/ +PGPError PGPtlsIsReusedSession( PGPtlsSessionRef ref, PGPBoolean *reused ); + +/*____________________________________________________________________________ + The following function must be called to initiate the PGPtls session. + Once a TLS session has been assigned to a socket, no data can be sent + over that socket by the application until the handshake is completed. + Handshake completion is indicated by completion of this call without + error or by checking the state of the PGPtlsSession. It will be + kPGPtls_ReadyState when the application layer may send and receive + data securely. + + This function performs all negotiation of the TLS connection. +____________________________________________________________________________*/ +PGPError PGPtlsHandshake( PGPtlsSessionRef ref ); + +/*____________________________________________________________________________ + The following function should be called before PGPtlsHandshake. + In the general case, the remoteID will be an IP address. This + is provided to PGPtls in order to allow it to cache the current + session and be able to look it up later. If the remoteID passed + into a future session is the same as a previously cached session, + PGPtls will attempt to resume the session. +____________________________________________________________________________*/ +PGPError PGPtlsSetRemoteUniqueID( PGPtlsSessionRef ref, + PGPUInt32 remoteID ); + +/*____________________________________________________________________________ + The following function sets the local private authenticating key. + + The passphrase and key are retained in memory. By default, no + key is specified and a client side session will return no key in the + client key exchange message to the server. + It is an error not to specify a key on a server side TLS session. + This function must be passed either PGPOPassphrase or PGPOPasskeyBuffer. + You may pass in just a PGP key, PGP w/ X.509 cert, or both -- and they + must be the same -- the cert must be from the key. For an X.509 cert, + the inCertChain keyset must contain the keys of all keys in the + certificate chain for that certificate up to the root. The inCertChain + keyset must remain valid for the lifetime of the TLS connection. +____________________________________________________________________________*/ +PGPError PGPtlsSetLocalPrivateKey( PGPtlsSessionRef ref, + PGPKeyDBObjRef inKeyObject, + PGPKeySetRef inCertChain, + PGPOptionListRef firstOption, ... ); + +/*____________________________________________________________________________ + The following function sets the preferred cipher suite. + + There is no guarantee that cipher will actually be negotiated, + but it will be attempted in preference to others. +____________________________________________________________________________*/ +PGPError PGPtlsSetPreferredCipherSuite( PGPtlsSessionRef ref, + PGPtlsCipherSuiteNum cipher ); + +/*____________________________________________________________________________ + The following function sets the desired DH prime. + + The requested primes are drawn from a set of primes hard-coded + into PGPtls. New primes can be added in a fully compatible + fashion since the server sends the prime to the client, but this + version of the API does not support passing in a desired prime. The + default prime if this function is not called is kPGPtls_DHPrime2048. +____________________________________________________________________________*/ +PGPError PGPtlsSetDHPrime( PGPtlsSessionRef ref, + PGPtlsPrime prime ); + +/*____________________________________________________________________________ + The following function gets the authenticated remote key after a + successful handshake. You must call this function after a successful + handshake to verify that the remote key is authorized to make the + connection. +____________________________________________________________________________*/ +PGPError PGPtlsGetRemoteAuthenticatedKey( PGPtlsSessionRef ref, + PGPKeyDBObjRef *outKey, + PGPKeyDBRef * outKeyDB ); + +/*____________________________________________________________________________ + The following function returns the negotiated symmetric cipher. + + This function will return an error if called before a successful + handshake. +____________________________________________________________________________*/ +PGPError PGPtlsGetNegotiatedCipherSuite( PGPtlsSessionRef ref, + PGPtlsCipherSuiteNum *outCipher ); + +PGPError PGPtlsGetState( PGPtlsSessionRef ref, + PGPtlsProtocolState *outState ); + +/*____________________________________________________________________________ + The following two functions process data through TLS. + + It is an error to call these functions without having set a + Read function pointer or Write function pointer. Most applications + will never need to use these functions as the function pointers + are automatically configured by PGPsockets, and these functions + are automatically called by the PGPsockets implementations of + PGPWrite and PGPRead whenever a PGPtlsSessionRef has been set for + a given socket. +____________________________________________________________________________*/ +PGPError PGPtlsReceive( PGPtlsSessionRef ref, + void * outBuffer, + PGPSize * bufferSize ); + +PGPError PGPtlsSend( PGPtlsSessionRef ref, + const void * inBuffer, + PGPSize inBufferLength ); + +PGPError PGPtlsSetReceiveCallback( PGPtlsSessionRef ref, + PGPtlsReceiveProcPtr tlsReceiveProc, + void * inData ); + +PGPError PGPtlsSetSendCallback( PGPtlsSessionRef ref, + PGPtlsSendProcPtr tlsSendProc, + void * inData ); + +PGPError PGPtlsSetPeekCallback( PGPtlsSessionRef ref, + PGPtlsPeekProcPtr tlsPeekProc, + void * inData ); + +/*____________________________________________________________________________ + The following function is necessary *only* on a non-blocking socket. + If a call to PGPtlsSend returns kPGPError_TLSWouldBlock, call + the following function repeatedly until that error is no longer + returned in order to make sure data is sent. Another call to + PGPtlsSend will also call this function automatically and queue + any new data if necessary. +____________________________________________________________________________*/ +PGPError PGPtlsSendQueueIdle( PGPtlsSessionRef ref ); + +PGPSize PGPtlsReceiveBufferSize( PGPtlsSessionRef ref ); + +/*____________________________________________________________________________ + The following function gets the ID of the fatal alert which caused + the TLS session to abort and go into the kPGPtls_FatalErrorState. +____________________________________________________________________________*/ +PGPError PGPtlsGetAlert( PGPtlsSessionRef ref, PGPtlsAlert *outAlert ); +const PGPChar * PGPtlsGetAlertString( PGPtlsAlert alert ); + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_PGPtls_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpUserInterface.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpUserInterface.h new file mode 100644 index 0000000000..210f1656f2 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpUserInterface.h @@ -0,0 +1,284 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + This file contains the prototypes for functions which use UI to interact + with the user. + + $Id: pgpUserInterface.h,v 1.21 2003/09/24 03:09:32 ajivsov Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpUserInterface_h /* [ */ +#define Included_pgpUserInterface_h + +#include "pgpPubTypes.h" +#include "pgpTLS.h" + +#if PGP_WIN32 +#include "windows.h" +#endif + +PGP_BEGIN_C_DECLARATIONS + +#if PGP_MACINTOSH +#pragma options align=mac68k +#endif + +enum PGPAdditionalRecipientRequestEnforcement_ +{ + kPGPARREnforcement_Invalid = 0, + kPGPARREnforcement_None = 1, + kPGPARREnforcement_Warn = 2, + kPGPARREnforcement_Strict = 3, + + PGP_ENUM_FORCE( PGPAdditionalRecipientRequestEnforcement_ ) +}; +PGPENUM_TYPEDEF( PGPAdditionalRecipientRequestEnforcement_, + PGPAdditionalRecipientRequestEnforcement ); + +enum PGPRecipientSpecType_ +{ + kPGPRecipientSpecType_Invalid = 0, + kPGPRecipientSpecType_Key = 1, + kPGPRecipientSpecType_UserID = 2, + kPGPRecipientSpecType_KeyID = 3, + + PGP_ENUM_FORCE( PGPRecipientSpecType_ ) +}; +PGPENUM_TYPEDEF( PGPRecipientSpecType_, PGPRecipientSpecType ); + +enum PGPRecipientSpecFlags_ +{ + kPGPRecipientSpecFlags_Locked = (1UL << 0), + + PGP_ENUM_FORCE( PGPRecipientSpecFlags_ ) +}; + +typedef PGPFlags PGPRecipientSpecFlags; + +typedef struct PGPRecipientSpec +{ + PGPRecipientSpecType type; + PGPRecipientSpecFlags flags; + PGPUInt32 reserved32[3]; /* Must be zero */ + + union + { + PGPKeyDBObjRef key; + PGPChar8 userIDStr[256]; /* Null terminated string */ + PGPKeyID keyID; + } u; + +} PGPRecipientSpec; + +typedef struct PGPKeyServerSpec +{ + PGPKeyServerRef server; + const PGPChar8 *serverName; /* Optional */ + const PGPChar8 *serverDomain; /* Optional */ + +} PGPKeyServerSpec; + +#if PGP_MACINTOSH +#pragma options align=reset +#endif + +PGPError PGPRecipientDialog( PGPContextRef context, PGPKeyDBRef sourceKeys, + PGPBoolean alwaysDisplayDialog, PGPKeyDBRef *recipientKeys, + PGPOptionListRef firstOption, ... ); + +PGPError PGPPassphraseDialog( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPConfirmationPassphraseDialog( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPKeyPassphraseDialog( PGPContextRef context, + PGPKeyDBObjRef keyDBObject, PGPOptionListRef firstOption, ... ); + +PGPError PGPSigningPassphraseDialog( PGPContextRef context, + PGPKeyDBRef sourceKeys, PGPKeyDBObjRef *signingKey, + PGPOptionListRef firstOption, ... ); + +PGPError PGPDecryptionPassphraseDialog( PGPContextRef context, + PGPKeySetRef recipientKeys, PGPUInt32 keyIDCount, + const PGPKeyID keyIDList[], PGPKeyDBObjRef *decryptionKey, + PGPOptionListRef firstOption, ... ); + +PGPError PGPConventionalEncryptionPassphraseDialog( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPConventionalDecryptionPassphraseDialog( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPOptionsDialog( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPCollectRandomDataDialog( PGPContextRef context, + PGPUInt32 neededEntropyBits, + PGPOptionListRef firstOption, ... ); + +PGPError PGPSearchKeyServerDialog( + PGPContextRef context, + PGPUInt32 serverCount, + const PGPKeyServerSpec serverList[], + PGPtlsContextRef tlsContext, + PGPBoolean searchAllServers, + PGPKeyDBRef *foundKeys, + PGPOptionListRef firstOption, ... ); + +PGPError PGPSendToKeyServerDialog( + PGPContextRef context, + const PGPKeyServerSpec *server, + PGPtlsContextRef tlsContext, + PGPKeySetRef keysToSend, + PGPKeySetRef *failedKeys, + PGPOptionListRef firstOption, ... ); + +/* +** Returns a value in the range 0-100 which crudely estimates +** the "quality" of a passphrase. +*/ + +#undef PGPEstimatePassphraseQuality +PGPUInt32 PGPEstimatePassphraseQuality( const PGPChar8 *passphrase ); + +/* General dialog options */ + +#undef PGPOUIDialogPrompt +PGPOptionListRef PGPOUIDialogPrompt( PGPContextRef context, + const PGPChar8 *prompt ); + +#undef PGPOUIWindowTitle +PGPOptionListRef PGPOUIWindowTitle( PGPContextRef context, + const PGPChar8 *title ); + +PGPOptionListRef PGPOUIDialogOptions( PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPOptionListRef PGPOUIDialogContextHelpButton(PGPContextRef context, + PGPBoolean showDialogContextHelpButton); + +#if PGP_WIN32 +PGPOptionListRef PGPOUIParentWindowHandle( PGPContextRef context, + HWND hwndParent ); +#endif + +/* All passphrase dialogs */ + +/* Caller should free passphrase with PGPFreeData() */ +#undef PGPOUIOutputPassphrase +PGPOptionListRef PGPOUIOutputPassphrase( PGPContextRef context, + PGPChar8 **passphrase ); + +PGPOptionListRef PGPOUIMinimumPassphraseQuality( PGPContextRef context, + PGPUInt32 minimumPassphraseQuality ); + +PGPOptionListRef PGPOUIMinimumPassphraseLength( PGPContextRef context, + PGPUInt32 minimumPassphraseLength ); + +/* Will cause the dialog to cancel if there has been no activity for x seconds */ +PGPOptionListRef PGPOUIDialogTimeout( PGPContextRef context, + PGPUInt32 seconds); + +/* PGPConfirmationPassphraseDialog() options */ + +PGPOptionListRef PGPOUIShowPassphraseQuality( PGPContextRef context, + PGPBoolean showPassphraseQuality ); + +/* PGPSigningPassphraseDialog() and PGPDecryptionPassphraseDialog() options */ + +PGPOptionListRef PGPOUIDefaultKey( PGPContextRef context, + PGPKeyDBObjRef defaultKey ); + +PGPOptionListRef PGPOUIVerifyPassphrase( PGPContextRef context, + PGPBoolean verifyPassphrase ); + +PGPOptionListRef PGPOUIFindMatchingKey( PGPContextRef context, + PGPBoolean findMatchingKey ); + +PGPOptionListRef PGPOUITextUI( PGPContextRef context, PGPBoolean textUI ); + +/* PGPRecipientDialog() options: */ + +PGPOptionListRef PGPOUIRecipientList( PGPContextRef context, + PGPUInt32 *recipientCount, + PGPRecipientSpec **recipientList ); + +PGPOptionListRef PGPOUIDefaultRecipients( PGPContextRef context, + PGPUInt32 recipientCount, + const PGPRecipientSpec recipientList[] ); + +PGPOptionListRef PGPOUIDisplayMarginalValidity( PGPContextRef context, + PGPBoolean displayMarginalValidity ); + +PGPOptionListRef PGPOUIIgnoreMarginalValidity( PGPContextRef context, + PGPBoolean ignoreMarginalValidity ); + +PGPOptionListRef PGPOUIEnforceAdditionalRecipientRequests( + PGPContextRef context, + PGPAdditionalRecipientRequestEnforcement enforcement, + PGPBoolean alwaysDisplayDialogWithARRs); + +/* PGPDecryptionPassphraseDialog() and PGPRecipientDialog() only: */ + +PGPOptionListRef PGPOUIKeyServerUpdateParams(PGPContextRef context, + PGPUInt32 serverCount, + const PGPKeyServerSpec serverList[], + PGPtlsContextRef tlsContext, + PGPBoolean searchBeforeDisplay, + PGPKeyDBRef *foundKeys, + PGPOptionListRef firstOption, ...); + +/* Key server search dialog options */ + +PGPOptionListRef PGPOUIKeyServerSearchFilter(PGPContextRef context, + PGPFilterRef filter); + +PGPOptionListRef PGPOUIKeyServerSearchKey(PGPContextRef context, + PGPKeyDBObjRef searchKeyObject); + +PGPOptionListRef PGPOUIKeyServerSearchKeySet(PGPContextRef context, + PGPKeySetRef keySet); + +PGPOptionListRef PGPOUIKeyServerSearchKeyIDList(PGPContextRef context, + PGPUInt32 keyIDCount, const PGPKeyID keyIDList[] ); + +/* +** These options are used to build the options dialog and are only +** applicable for the PGPOptionsDialog() and PGPOUIDialogOptions() calls. +** The "description" parameters are optional. +*/ +#undef PGPOUICheckbox +PGPOptionListRef PGPOUICheckbox(PGPContextRef context, PGPUInt32 itemID, + const PGPChar8 *title, const PGPChar8 *description, + PGPUInt32 initialValue, PGPUInt32 *resultPtr, + PGPOptionListRef firstOption, ...); +#undef PGPOUIPopupList +PGPOptionListRef PGPOUIPopupList(PGPContextRef context, PGPUInt32 itemID, + const PGPChar8 *title, const PGPChar8 *description, + PGPUInt32 listItemCount, const PGPChar8 *listItems[], + PGPUInt32 initialValue, PGPUInt32 *resultPtr, + PGPOptionListRef firstOption, ...); + +#if PGP_DEPRECATED + +#include "pgpGroups.h" + +PGPOptionListRef PGPOUIRecipientGroups(PGPContextRef context, + PGPGroupSetRef groupSet); +#endif + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpUserInterface_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/include/pgpUtilities.h b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpUtilities.h new file mode 100644 index 0000000000..dc1ca20d62 --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/include/pgpUtilities.h @@ -0,0 +1,464 @@ +/*____________________________________________________________________________ + Copyright (C) 2002 PGP Corporation + All rights reserved. + + This file contains miscellaneous utility functions needed for the PGPsdk. + + $Id: pgpUtilities.h,v 1.54.2.1 2004/05/05 17:02:51 vinnie Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpUtilities_h /* [ */ +#define Included_pgpUtilities_h + +#include <time.h> +#include "pgpBase.h" +#include "pflTypes.h" +#include "pgpPubTypes.h" +#include "pgpMemoryMgr.h" + +#if PGP_MACINTOSH /* [ */ +#include <Files.h> +#elif PGP_OSX + struct FSSpec; +#endif /* ] PGP_MACINTOSH */ + +#if PGP_MACINTOSH +#pragma options align=mac68k /* [ */ +#endif + +enum +{ + kPGPsdk20APIVersion = 0x01000000, + + kPGPsdkAPIVersion = kPGPsdk20APIVersion +}; + +enum PGPNotificationReason_ +{ + kPGPNotification_KeyDBChanged = 0, + kPGPNotification_PassphraseCacheChanged = 1, + + PGP_ENUM_FORCE( PGPNotificationReason_ ) +}; + +PGPENUM_TYPEDEF( PGPNotificationReason_, PGPNotificationReason ); + +typedef PFLLanguage PGPLanguage; + +enum PGPLanguage_ +{ + kPGPLanguage_Default = 0, + kPGPLanguage_English = 1, + kPGPLanguage_Japanese = 2, + kPGPLanguage_German = 3, + kPGPLanguage_Spanish = 4, + + PGP_ENUM_FORCE( PGPLanguage_ ) +}; + +#if PGP_MACINTOSH || PGP_OSX /* [ */ + +#define kPGPMacFileCreator_PGPkeys 'pgpK' +#define kPGPMacFileCreator_PGPtools 'pgpM' +#define kPGPMacFileCreator_PGPnet 'PGPn' +#define kPGPMacFileCreator_PGPdisk 'pgpD' +#define kPGPMacFileCreator_PGPadmin 'PGPa' +#define kPGPMacFileCreator_DecryptedBinary '\?\?\?\?' +#define kPGPMacFileCreator_DecryptedText 'ttxt' + +#define kPGPMacFileType_ArmorFile 'TEXT' +#define kPGPMacFileType_EncryptedData 'pgEF' +#define kPGPMacFileType_SignedData 'pgSF' +#define kPGPMacFileType_DetachedSig 'pgDS' +#define kPGPMacFileType_RandomSeed 'pgRS' +#define kPGPMacFileType_PrivRing 'pgRR' +#define kPGPMacFileType_PubRing 'pgPR' +#define kPGPMacFileType_Groups 'pgGR' +#define kPGPMacFileType_NetHosts 'pgHO' +#define kPGPMacFileType_NetRules 'pgRU' +#define kPGPMacFileType_Preferences 'pref' +#define kPGPMacFileType_DecryptedText 'TEXT' +#define kPGPMacFileType_DecryptedBinary 'BINA' +#define kPGPMacFileType_KeyShares 'pgSK' +#define kPGPMacFileType_Exported509Keys 'pgX5' + +#endif /* ] PGP_MACINTOSH */ + +PGP_BEGIN_C_DECLARATIONS + +/*____________________________________________________________________________ + PGPsdk initialization + + Call PGPsdkXXXInit() before using that particular library. + Call PGPsdkXXXCleanup() when you are done (but after disposing of any + PGPContexts). + + You may call PGPsdkXXXInit multiple times (with no effect), but be sure + to call the matching PGPsdkXXXCleanup() for each call to PGPsdkXXXInit(). +____________________________________________________________________________*/ +#define kPGPFlags_ForceLocalExecution 0x2 +#define kPGPFlags_SuppressCacheThread 0x4 + +PGPError PGPsdkInit( PGPFlags options ) ; +PGPError PGPsdkSetLanguage( PGPFileSpecRef langStringsHome, PGPLanguage lang ); +PGPError PGPsdkCleanup( void ); + +PGPError PGPsdkNetworkLibInit( PGPFlags options ); +PGPError PGPsdkNetworkLibCleanup( void ); + +PGPError PGPsdkUILibInit( PGPFlags options ); +PGPError PGPsdkUILibCleanup( void ); + +PGPError PGPLoadPluginModule( PGPContextRef context, + PGPFileSpecRef moduleFile, PGPFileSpecRef sigFile, + PGPUInt32 *nCipher, PGPUInt32 *nHash, PGPUInt32 *nPubkey ); + + +/*____________________________________________________________________________ + PGPsdk version information + + A version in the PGPsdk is expressed as follows: + + Major version (1 byte) + Minor version (1 byte) + Bug fix revision (1 byte) + Reserved (1 byte) + + example: 1.7.1 = 0x01070100 +____________________________________________________________________________*/ + +PGPUInt32 PGPGetPGPsdkVersion( void ); + +/*____________________________________________________________________________ + PGPsdk version string + + Return a C string of the form: + + "PGPsdk 3.0 Copyright (C) 2003 PGP Corporation +____________________________________________________________________________*/ + +#undef PGPGetPGPsdkVersionString +PGPError PGPGetPGPsdkVersionString( PGPChar8 versionString[ 256 ] ); + +/*____________________________________________________________________________ + PGPsdk API version information + + The API version of the PGPsdk is distinct from the externally visible + version number. The API version is revised only when API changes are made, + while the external version is changed whenever any code is changed, API or + otherwise. The format of the API version is identical to the format of the + external version. A change in the major API version implies incompatability + with previous API versions while a change in the minor version implies API + additions which maintain backwards compatability. +_____________________________________________________________________________*/ + +PGPUInt32 PGPGetPGPsdkAPIVersion( void ); + +/*____________________________________________________________________________ + PGPsdk context manipulation +_____________________________________________________________________________*/ + +typedef struct PGPCustomContextInfo +{ + PGPUInt32 sdkAPIVersion; /* Use kPGPsdkAPIVersion */ + PGPMemoryMgrRef memoryMgr; + PGPUserValue userValue; + +} PGPCustomContextInfo; + + +PGPError PGPNewContext( PGPUInt32 sdkAPIVersion, PGPContextRef *newContext ); +PGPError PGPNewContextCustom( const PGPCustomContextInfo *contextInfo, + PGPContextRef *newContext ); + +PGPError PGPFreeContext( PGPContextRef context ); + +PGPError PGPGetContextUserValue( PGPContextRef context, + PGPUserValue *userValue ); +PGPError PGPSetContextUserValue( PGPContextRef context, + PGPUserValue userValue ); + +PGPError PGPContextGetRandomBytes(PGPContextRef context, + void *buf, PGPSize len ); + +PGPUInt32 PGPContextReserveRandomBytes(PGPContextRef context, + PGPUInt32 minSize ); + +PGPMemoryMgrRef PGPPeekContextMemoryMgr( PGPContextRef context ); + +/*____________________________________________________________________________ + PGP file management + + All files in PGP are represented using an opage data type PGPFileSpecRef. + These data types are created using a fully qualified path or, on the + Macintosh, an FSSpec. The +____________________________________________________________________________*/ + +#if PGP_MACINTOSH || PGP_OSX /* [ */ + +PGPError PGPNewFileSpecFromFSSpec( PGPContextRef context, const struct FSSpec *spec, + PGPFileSpecRef *ref ); +PGPError PGPGetFSSpecFromFileSpec( PGPFileSpecRef fileRef, struct FSSpec *spec ); + +#endif + +#if ! PGP_MACINTOSH + +#undef PGPNewFileSpecFromFullPath +PGPError PGPNewFileSpecFromFullPath( PGPContextRef context, + const PGPChar8 *path, PGPFileSpecRef *ref ); +/* +** The full path is an allocated object which needs to be deallocated with +** PGPFreeData() +*/ + +#undef PGPGetFullPathFromFileSpec +PGPError PGPGetFullPathFromFileSpec( PGPFileSpecRef fileRef, + PGPChar8 **fullPathPtr); + +#endif + +PGPError PGPCopyFileSpec( PGPFileSpecRef fileRef, PGPFileSpecRef *ref ); +PGPError PGPFreeFileSpec( PGPFileSpecRef fileRef ); + +#undef PGPRenameFile +PGPError PGPRenameFile( PGPFileSpecRef fileRef, const PGPChar8 *newName ); +PGPError PGPDeleteFile( PGPFileSpecRef fileRef ); + +/*____________________________________________________________________________ + PGP time/date functions +____________________________________________________________________________*/ + +PGPTime PGPGetTime(void); + +/* these use time_t type as returned by time() in Std C libraries */ +time_t PGPGetStdTimeFromPGPTime( PGPTime theTime ); +PGPTime PGPGetPGPTimeFromStdTime( time_t theTime ); + +/* year, month, day may be NULL if desired */ +void PGPGetYMDFromPGPTime( PGPTime theTime, PGPUInt16 *year, + PGPUInt16 *month, PGPUInt16 *day ); + +#if PGP_MACINTOSH || PGP_OSX /* [ */ + +PGPUInt32 PGPTimeToMacTime( PGPTime theTime ); +PGPTime PGPTimeFromMacTime( PGPUInt32 theTime ); + +#endif /* ] PGP_MACINTOSH */ + +/*____________________________________________________________________________ + MacBinary support + + Examine the input file to see if it's a MacBinary file. If it is + not a MacBinary file, then the original file is unaltered. + Otherwise, the file is converted and the original file is deleted. + + The resulting file is designated by 'outPGPSpec' and may have a different + name than the original. + + If the file is a TEXT file, appropriate line-end conversion is done. + + creator and type code pointers may be + null but otherwise contain the mac creator and type. + + This routine can be called on a Mac, but generally doesn't need to be. +____________________________________________________________________________*/ + +PGPError PGPMacBinaryToLocal( PGPFileSpecRef inSpec, + PGPFileSpecRef * outSpec, PGPUInt32 * macCreator, + PGPUInt32 * macTypeCode ); + +/*____________________________________________________________________________ + Notification callbacks on PGPKeyDB changes from SDK Service +_____________________________________________________________________________*/ + +typedef void (*PGPNotificationHandlerProc)( PGPUserValue userValue, + PGPNotificationReason reason, + PGPUInt32 param1, + PGPUInt32 param2 ); + +PGPError PGPSetNotificationCallback( PGPNotificationHandlerProc proc, + PGPUserValue userValue ); + +/*____________________________________________________________________________ +Disk and File Wipe Pattern Support +____________________________________________________________________________*/ + +PGPError PGPNewWipePatternContext ( PGPContextRef context, + PGPInt32 numPasses, + PGPWipePatternContextRef *outRef); + +/* fill a 1024 byte, long word alligned buffer with a pattern to wipe with */ +PGPError PGPWipePatternNext( PGPWipePatternContextRef ref, + void * buffer, PGPSize bufferSize); + +PGPError PGPWipePatternRewind( PGPWipePatternContextRef wipeRef); + +PGPError PGPFreeWipePatternContext(PGPWipePatternContextRef ref); + +PGPError PGPWipeFile( PGPContextRef context, + PGPInt32 numPasses, + PGPOptionListRef firstOption, + ...); + +/*____________________________________________________________________________ + PGP TAR/UnTAR functions that work with TAR cache +____________________________________________________________________________*/ + +enum PGPTARCacheObjAttributeType_ +{ + kPGPTARCacheObjAttribute_Invalid = 0, + kPGPTARCacheObjAttribute_File = 1, + kPGPTARCacheObjAttribute_SymLink = 2, + kPGPTARCacheObjAttribute_Directory = 3, + kPGPTARCacheObjAttribute_Deleted = 4, + + PGP_ENUM_FORCE( PGPTARCacheObjAttributeType_ ) +} ; + +PGPENUM_TYPEDEF( PGPTARCacheObjAttributeType_, PGPTARCacheObjAttributeType ); + +enum PGPTARCacheObjProperty_ +{ + kPGPTARCacheObjProperty_Invalid = 0, + + /* string properties */ + kPGPTARCacheObjProperty_Name = 100, + kPGPTARCacheObjProperty_User = 101, + kPGPTARCacheObjProperty_Group = 102, + kPGPTARCacheObjProperty_Contents = 103, + kPGPTARCacheObjProperty_Link = 104, + kPGPTARCacheObjProperty_Size = 105, /* PGPUInt64 */ + kPGPTARCacheObjProperty_FilePos = 106, /* PGPFileOffset */ + + /* PGPTime properties */ + kPGPTARCacheObjProperty_Date = 200, + + /* Numeric properties */ + kPGPTARCacheObjProperty_Mode = 302, + kPGPTARCacheObjProperty_Attribute = 303, + + PGP_ENUM_FORCE( PGPTARCacheObjProperty_ ) +} ; + +PGPENUM_TYPEDEF( PGPTARCacheObjProperty_, PGPTARCacheObjProperty ); +enum PGPOpenTARCacheFileOptions_ +{ + kPGPOpenTARCacheFileOptions_None = 0, + kPGPOpenTARCacheFileOptions_Mutable = (1UL << 0 ), + kPGPOpenTARCacheFileOptions_Create = (1UL << 1 ), + kPGPOpenTARCacheFileOptions_PreloadAll = (1UL << 2 ), + + PGP_ENUM_FORCE( PGPOpenTARCacheFileOptions_ ) +} ; + +PGPENUM_TYPEDEF( PGPOpenTARCacheFileOptions_, PGPOpenTARCacheFileOptions ); + + +PGPError PGPOpenTARCacheFile( PGPContextRef context, + PGPOpenTARCacheFileOptions options, + PGPFileSpecRef tarcache, + void *sessionKey, + PGPSize sessionKeyBufferSize, + PGPSize *sessionKeySize, /* can be NULL if not kPGPOpenTARCacheFileOptions_Create */ + PGPTARCacheRef *outRef, + PGPOptionListRef firstOption, + ...); + +PGPError PGPFreeTARCache(PGPTARCacheRef ref); + +PGPError PGPNewTARCacheIter( PGPTARCacheRef tar, PGPTARCacheIterRef *outRef); + +PGPError PGPFreeTARCacheIter( PGPTARCacheIterRef iter); + +PGPInt32 PGPTARCacheIterIndex( PGPTARCacheIterRef iter); + +PGPError PGPTARCacheIterRewind( PGPTARCacheIterRef iter); + +PGPError PGPTARCacheIterMove( PGPTARCacheIterRef iter, PGPInt32 relOffset, PGPTARCacheObjRef *outRef); + +PGPError PGPTARCacheIterNextTARCacheObj( PGPTARCacheIterRef iter, PGPTARCacheObjRef *outRef); + +PGPError PGPTARCacheIterPrevTARCacheObj( PGPTARCacheIterRef iter, PGPTARCacheObjRef *outRef); + +PGPError PGPTARCacheIterGetTARCacheObj( PGPTARCacheIterRef iter, PGPTARCacheObjRef *outRef); + +PGPError PGPGetTARCacheObjNumericProperty( PGPTARCacheObjRef obj, + PGPTARCacheObjProperty whichProperty, PGPInt32 *prop ); + +PGPError PGPGetTARCacheObjTimeProperty( PGPTARCacheObjRef obj, + PGPTARCacheObjProperty whichProperty, PGPTime *prop); + + PGPError PGPGetTARCacheObjDataProperty( PGPTARCacheObjRef obj, + PGPTARCacheObjProperty whichProperty, void *buffer, + PGPSize bufferSize, PGPSize *dataSize); + +PGPError PGPGetTARCacheObjAllocatedDataProperty( PGPTARCacheObjRef obj, + PGPTARCacheObjProperty whichProperty, void **buffer, + PGPSize *dataSize); + + +PGPError PGPDeleteTARCacheObj( PGPTARCacheObjRef tarObj ); + +PGPError PGPExportTARCacheObj( PGPTARCacheObjRef tarObj, + PGPFileSpecRef fileRef, + PGPOptionListRef firstOption, + ...); + + +PGPError PGPCountObjsInTARCache( PGPTARCacheRef ref, PGPUInt32 *numItems ); + +PGPError PGPImportTARCacheObj( PGPTARCacheRef tarCache, + PGPFileSpecRef fileRef, + PGPTARCacheObjRef *outRef, + PGPOptionListRef firstOption, + ...); + +/*____________________________________________________________________________ +FIPS 140-2 Support +____________________________________________________________________________*/ + +enum PGPsdkSelfTest_ +{ + kPGPsdkSelfTest_Invalid = 0, + kPGPsdkSelfTest_FirstTest = 1, + + kPGPsdkSelfTest_3DES = 1, + kPGPsdkSelfTest_DSA = 2, + kPGPsdkSelfTest_AES = 3, + kPGPsdkSelfTest_RSA = 4, + kPGPsdkSelfTest_SHA = 5, + kPGPsdkSelfTest_HMAC = 6, + kPGPsdkSelfTest_EC = 7, + kPGPsdkSelfTest_PRNG = 8, + kPGPsdkSelfTest_Integrity = 9, + + kPGPsdkSelfTest_LastTest = kPGPsdkSelfTest_Integrity, + + PGP_ENUM_FORCE( PGPsdkSelfTest_ ) +}; + +PGPENUM_TYPEDEF( PGPsdkSelfTest_, PGPsdkSelfTest ); + +PGPError PGPEnableFIPSMode(void); +PGPError PGPGetSDKErrorState(void); +PGPError PGPResetSDKErrorState(void); +PGPError PGPRunSDKSelfTest(PGPsdkSelfTest whichTest); +PGPError PGPRunAllSDKSelfTests(void); + +PGP_END_C_DECLARATIONS + +#if PGP_MACINTOSH +#pragma options align=reset /* ] */ +#endif + +#endif /* ] Included_pgpUtilities_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdk.lib b/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdk.lib Binary files differnew file mode 100644 index 0000000000..c0950deded --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdk.lib diff --git a/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdkNL.lib b/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdkNL.lib Binary files differnew file mode 100644 index 0000000000..09b4a3463e --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdkNL.lib diff --git a/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdkUI.lib b/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdkUI.lib Binary files differnew file mode 100644 index 0000000000..9a9ae7f89c --- /dev/null +++ b/plugins/CryptoPP/src/PGPw/sdk8/lib/PGPsdkUI.lib diff --git a/plugins/CryptoPP/src/base16.cpp b/plugins/CryptoPP/src/base16.cpp new file mode 100644 index 0000000000..ace113ff76 --- /dev/null +++ b/plugins/CryptoPP/src/base16.cpp @@ -0,0 +1,64 @@ +#include "commonheaders.h"
+
+
+char *base16encode(const char *inBuffer, int count) {
+
+ char *outBuffer = (char *) malloc(count*2+1);
+ char *outBufferPtr = outBuffer;
+ BYTE *inBufferPtr = (BYTE *) inBuffer;
+
+ while(count){
+ *outBufferPtr++ = encode16(((*inBufferPtr)>>4)&0x0F);
+ *outBufferPtr++ = encode16((*inBufferPtr++)&0x0F);
+ count--;
+ }
+ *outBufferPtr = '\0';
+
+ return outBuffer;
+}
+
+
+char *base16decode(const char *inBuffer, size_t *count) {
+
+ char *outBuffer = (char *) malloc(*count);
+ BYTE *outBufferPtr = (BYTE *) outBuffer;
+ bool big_endian = false;
+
+ if (*inBuffer == '0' && *(inBuffer+1) == 'x') {
+ inBuffer += *count;
+ big_endian = true;
+ *count -= 2;
+ }
+ while(*count>1){
+ BYTE c0,c1;
+ if (big_endian) {
+ c1 = decode16(*--inBuffer);
+ c0 = decode16(*--inBuffer);
+ }
+ else {
+ c0 = decode16(*inBuffer++);
+ c1 = decode16(*inBuffer++);
+ }
+ if ((c0 | c1) == BERR) {
+ free(outBuffer);
+ *count = 0;
+ return(NULL);
+ }
+ *outBufferPtr++ = (c0<<4) | c1;
+ *count -= 2;
+ }
+ *outBufferPtr = '\0';
+ *count = (int)(outBufferPtr-(BYTE *)outBuffer);
+
+ return outBuffer;
+}
+
+
+char *base16decode(const char *inBuffer)
+{
+ size_t count = strlen(inBuffer);
+ return base16decode(inBuffer, &count);
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/base16.h b/plugins/CryptoPP/src/base16.h new file mode 100644 index 0000000000..2a2c18c42a --- /dev/null +++ b/plugins/CryptoPP/src/base16.h @@ -0,0 +1,53 @@ +#ifndef __BASE_16__
+#define __BASE_16__
+
+#define BERR 0xFF /* Illegal char marker */
+#define BEOF 0x7F /* EOF marker (padding char or EOL) */
+
+typedef unsigned char byte;
+
+static const byte asciiToBin16[] =
+ { BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BEOF, BERR, BERR, BEOF, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, BERR, BERR, BERR, BEOF, BERR, BERR,
+ BERR, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR
+ };
+
+static const byte binToAscii16[] = "0123456789ABCDEF";
+
+char *base16encode(const char *, const int);
+char *base16decode(const char *, size_t *);
+char *base16decode(const char *);
+
+#define encode16(data) binToAscii16[data]
+#define decode16(data) asciiToBin16[data]
+
+#endif
diff --git a/plugins/CryptoPP/src/base64.cpp b/plugins/CryptoPP/src/base64.cpp new file mode 100644 index 0000000000..7495dd234f --- /dev/null +++ b/plugins/CryptoPP/src/base64.cpp @@ -0,0 +1,97 @@ +#include "commonheaders.h"
+
+
+string base64encode(const string buf)
+{
+ string out;
+ char *base64 = base64encode(buf.data(), buf.length());
+ out.assign(base64);
+ free(base64);
+ return out;
+}
+
+
+char *base64encode(const char *inBuffer, const int count) {
+
+ int srcIndex = 0, destIndex = 0, remainder = count % 3;
+ char *outBuffer = (char *) malloc(count*2+1);
+ BYTE *inBufferPtr = (BYTE *) inBuffer;
+
+ while(srcIndex < count) {
+ outBuffer[destIndex++] = encode64(inBufferPtr[srcIndex] >> 2);
+ outBuffer[destIndex++] = encode64(((inBufferPtr[srcIndex] << 4) & 0x30) | ((inBufferPtr[srcIndex + 1] >> 4) & 0x0F));
+ srcIndex++;
+ outBuffer[destIndex++] = encode64(((inBufferPtr[srcIndex] << 2) & 0x3C) | ((inBufferPtr[srcIndex + 1] >> 6) & 0x03));
+ srcIndex++;
+ outBuffer[destIndex++] = encode64(inBufferPtr[srcIndex++] & 0x3F);
+ }
+
+ if (remainder == 2) {
+ outBuffer[destIndex - 1] = BPAD;
+ outBuffer[destIndex - 2] = encode64((inBufferPtr[srcIndex - 2] << 2) & 0x3C);
+ }
+ else if (remainder == 1) {
+ outBuffer[destIndex - 2] = outBuffer[destIndex - 1] = BPAD;
+ outBuffer[destIndex - 3] = encode64((inBufferPtr[srcIndex - 3] << 4) & 0x30);
+ }
+ destIndex -= (3 - remainder) % 3;
+ outBuffer[destIndex] = '\0';
+
+ return outBuffer;
+}
+
+
+string base64decode(const string buf) {
+ string out;
+ size_t len = buf.length();
+ char *plain = base64decode(buf.data(), &len);
+ out.assign(plain,len);
+ free(plain);
+ return out;
+}
+
+
+string base64decode(const char *buf) {
+ string out;
+ size_t len = strlen(buf);
+ char *plain = base64decode(buf, &len);
+ out.assign(plain,len);
+ free(plain);
+ return out;
+}
+
+
+char *base64decode(const char *inBuffer, size_t *count) {
+
+ int srcIndex = 0, destIndex = 0;
+ char *outBuffer = (char *) malloc(*count);
+
+ while(srcIndex < *count) {
+ BYTE c0, c1, c2 = 0, c3 = 0;
+ const size_t delta = *count - srcIndex;
+ c0 = decode64(inBuffer[srcIndex++]);
+ c1 = decode64(inBuffer[srcIndex++]);
+ if (delta > 2) {
+ c2 = decode64(inBuffer[srcIndex++]);
+ if (delta > 3)
+ c3 = decode64(inBuffer[srcIndex++]);
+ }
+ if ((c0 | c1 | c2 | c3) == BERR) {
+ free(outBuffer);
+ return(NULL);
+ }
+ outBuffer[destIndex++] = (c0 << 2) | (c1 >> 4);
+ if (delta > 2) {
+ outBuffer[destIndex++] = (c1 << 4) | (c2 >> 2);
+ if (delta > 3 )
+ outBuffer[destIndex++] = (c2 << 6) | (c3);
+ }
+ }
+ outBuffer[destIndex] = '\0';
+ *count = destIndex;
+
+ return outBuffer;
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/base64.h b/plugins/CryptoPP/src/base64.h new file mode 100644 index 0000000000..1024ecbbd7 --- /dev/null +++ b/plugins/CryptoPP/src/base64.h @@ -0,0 +1,58 @@ +#ifndef __BASE_64__
+#define __BASE_64__
+
+#define BPAD '=' /* Padding for odd-sized output */
+#define BERR 0xFF /* Illegal char marker */
+#define BEOF 0x7F /* EOF marker (padding char or EOL) */
+
+typedef unsigned char byte;
+
+static const byte asciiToBin64[] =
+ { BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BEOF, BERR, BERR, BEOF, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, 0x3E, BERR, BERR, BERR, 0x3F,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
+ 0x3C, 0x3D, BERR, BERR, BERR, BEOF, BERR, BERR,
+ BERR, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
+ 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+ 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x17, 0x18, 0x19, BERR, BERR, BERR, BERR, BERR,
+ BERR, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
+ 0x31, 0x32, 0x33, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR,
+ BERR, BERR, BERR, BERR, BERR, BERR, BERR, BERR
+ };
+
+static const byte binToAscii64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+char *base64encode(const char *, const int);
+char *base64decode(const char *, size_t *);
+
+string base64encode(const string);
+string base64decode(const string);
+
+string base64decode(const char *);
+
+#define encode64(data) binToAscii64[data]
+#define decode64(data) asciiToBin64[data]
+
+#endif
diff --git a/plugins/CryptoPP/src/commonheaders.cpp b/plugins/CryptoPP/src/commonheaders.cpp new file mode 100644 index 0000000000..04a92adb1c --- /dev/null +++ b/plugins/CryptoPP/src/commonheaders.cpp @@ -0,0 +1,110 @@ +#include "commonheaders.h"
+
+LPCSTR szModuleName = MODULENAME;
+LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
+HINSTANCE g_hInst;
+
+HANDLE hPGPPRIV = NULL;
+HANDLE hRSA4096 = NULL;
+
+CRITICAL_SECTION localQueueMutex;
+CRITICAL_SECTION localContextMutex;
+
+char TEMP[MAX_PATH];
+int TEMP_SIZE = 0;
+BOOL isVista = 0;
+
+PLUGININFOEX pluginInfoEx = {
+ sizeof(PLUGININFOEX),
+ MODULENAME,
+ __VERSION_DWORD,
+ MODULENAME" library for SecureIM plugin ("__DATE__")",
+ "Baloo",
+ "baloo@bk.ru",
+ "© 2006-09 Baloo",
+ "http://miranda-im.org/download/details.php?action=viewfile&id=2669",
+ 0,
+ MIID_CRYPTOPP
+};
+
+
+BOOL ExtractFileFromResource( HANDLE FH, int ResType, int ResId, DWORD* Size )
+{
+ HRSRC RH;
+ PBYTE RP;
+ DWORD s,x;
+
+ RH = FindResource( g_hInst, MAKEINTRESOURCE( ResId ), MAKEINTRESOURCE( ResType ) );
+
+ if ( RH == NULL ) return FALSE;
+ RP = (PBYTE) LoadResource( g_hInst, RH );
+ if ( RP == NULL ) return FALSE;
+ s = SizeofResource( g_hInst, RH );
+ if ( !WriteFile( FH, RP, s, &x, NULL ) ) return FALSE;
+ if ( x != s ) return FALSE;
+ if ( Size ) *Size = s;
+ return TRUE;
+}
+
+
+void ExtractFile( char *FileName, int ResType, int ResId )
+{
+ HANDLE FH;
+ FH = CreateFile( FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
+ if ( FH == INVALID_HANDLE_VALUE ) return;
+ if (!ExtractFileFromResource( FH, ResType, ResId, NULL )) MessageBoxA(0,"Can't extract","!!!",MB_OK);
+ CloseHandle( FH );
+}
+
+
+size_t rtrim(LPCSTR str) {
+ size_t len = strlen(str);
+ LPSTR ptr = (LPSTR)str+len-1;
+
+ while( len ) {
+ char c = *ptr;
+ if ( c != '\x20' && c != '\x09' && c != '\x0A' && c != '\x0D' ) {
+ *(ptr+1) = '\0';
+ break;
+ }
+ len--; ptr--;
+ }
+ return len;
+}
+
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+HANDLE hNetlibUser;
+
+void InitNetlib() {
+ NETLIBUSER nl_user;
+ memset(&nl_user,0,sizeof(nl_user));
+ nl_user.cbSize = sizeof(nl_user);
+ nl_user.szSettingsModule = (LPSTR)szModuleName;
+ nl_user.szDescriptiveName = (LPSTR)szModuleName;
+ nl_user.flags = NUF_NOOPTIONS;
+
+ hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+}
+
+void DeinitNetlib() {
+ if (hNetlibUser)
+ CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0);
+}
+
+int Sent_NetLog(const char *fmt,...)
+{
+ va_list va;
+ char szText[1024];
+
+ va_start(va,fmt);
+ mir_vsnprintf(szText,sizeof(szText),fmt,va);
+ va_end(va);
+ if (hNetlibUser)
+ return CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szText);
+ return 0;
+}
+#endif
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/commonheaders.h b/plugins/CryptoPP/src/commonheaders.h new file mode 100644 index 0000000000..d42577d7bc --- /dev/null +++ b/plugins/CryptoPP/src/commonheaders.h @@ -0,0 +1,172 @@ +// Windows API
+#define _CRT_NONSTDC_NO_DEPRECATE
+#define WIN32_LEAN_AND_MEAN
+#define NETLIB_LOG
+#define CRYPTOPP_DEFAULT_NO_DLL
+
+#ifdef _MSC_VER
+ #pragma once
+ #define _CRT_SECURE_NO_WARNINGS
+ #define _SCL_SECURE_NO_WARNINGS
+ #define NOMINMAX
+ #ifndef WIN64
+ #define _USE_32BIT_TIME_T
+ #endif
+#endif
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0501
+#endif
+
+#include <limits>
+
+#define MIRANDA_VER 0x0A00
+#include <m_stdhdr.h>
+
+#include <windows.h>
+#include <wincrypt.h>
+#include <winsock2.h>
+
+#include <process.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#pragma comment(lib,"kernel32.lib")
+#pragma comment(lib,"user32.lib")
+
+#ifndef M_API_H__
+#define M_API_H__
+
+// Miranda API
+#include <newpluginapi.h>
+#include <m_stdhdr.h>
+#include <m_system.h>
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_protomod.h>
+#include <m_protosvc.h>
+#include <m_utils.h>
+#include <m_netlib.h>
+
+#endif
+
+#include "cryptopp.h"
+#include "version.h"
+#include "resource.h"
+#include "dllloader.h"
+#include "mmi.h"
+#include "utf8.h"
+#include "base16.h"
+#include "base64.h"
+#include "gettime.h"
+#include "cpp_rsam.h"
+#include "cpp_rsau.h"
+
+#define MODULENAME "Crypto++"
+
+extern LPCSTR szModuleName;
+extern LPCSTR szVersionStr;
+extern TCHAR TEMP[MAX_PATH];
+extern int TEMP_SIZE;
+extern BOOL isVista;
+
+// shared vars
+extern HINSTANCE g_hInst;
+extern PLUGININFOEX pluginInfoEx;
+
+extern HANDLE hPGPPRIV;
+extern HANDLE hRSA4096;
+
+extern CRITICAL_SECTION localQueueMutex;
+extern CRITICAL_SECTION localContextMutex;
+
+void ExtractFile(char*,int,int);
+size_t rtrim(LPCSTR);
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+extern HANDLE hNetlibUser;
+void InitNetlib();
+void DeinitNetlib();
+int Sent_NetLog(const char *,...);
+#endif
+
+#define MIID_CRYPTOPP {0x3613F2D9, 0xC040, 0x4361, { 0xA4, 0x4F, 0xDF, 0x7B, 0x5A, 0xAA, 0xCF, 0x6E }} //3613F2D9-C040-4361-A44F-DF7B5AAACF6E
+
+#define DLLEXPORT __declspec(dllexport)
+
+PBYTE cpp_alloc_pdata(pCNTX);
+
+extern "C" {
+
+ DLLEXPORT int Load();
+ DLLEXPORT PLUGININFOEX *MirandaPluginInfoEx(DWORD);
+ DLLEXPORT int Unload();
+
+ DLLEXPORT HANDLE __cdecl cpp_create_context(int); // create crypt-context
+ DLLEXPORT void __cdecl cpp_delete_context(HANDLE); // delete crypt-context
+ DLLEXPORT void __cdecl cpp_reset_context(HANDLE); // reset crypt-context (free all data)
+ DLLEXPORT LPSTR __cdecl cpp_init_keya(HANDLE,int); // make KeyA
+ DLLEXPORT int __cdecl cpp_init_keyb(HANDLE,LPCSTR); // load KeyB
+ DLLEXPORT int __cdecl cpp_calc_keyx(HANDLE); // calculate KeyX
+ DLLEXPORT int __cdecl cpp_init_keyp(HANDLE,LPCSTR); // make KeyP from password
+ DLLEXPORT LPSTR __cdecl cpp_encodeA(HANDLE,LPCSTR); // encode ANSIz string
+ DLLEXPORT LPSTR __cdecl cpp_encodeW(HANDLE,LPWSTR); // encode USC2z string
+ DLLEXPORT LPSTR __cdecl cpp_encodeU(HANDLE,LPCSTR); // encode UTF8z string
+ DLLEXPORT LPSTR __cdecl cpp_decode(HANDLE,LPCSTR); // decode as ANSIzUCS2z
+ DLLEXPORT LPSTR __cdecl cpp_decodeU(HANDLE,LPCSTR); // decode as UTF8z
+ DLLEXPORT int __cdecl cpp_encrypt_file(HANDLE,LPCSTR,LPCSTR); // encrypt file
+ DLLEXPORT int __cdecl cpp_decrypt_file(HANDLE,LPCSTR,LPCSTR); // decrypt file
+ DLLEXPORT int __cdecl cpp_get_features(HANDLE); // get features field from client
+ DLLEXPORT int __cdecl cpp_get_error(HANDLE); // get last error code
+ DLLEXPORT int __cdecl cpp_get_version(void); // get dll version
+ DLLEXPORT int __cdecl cpp_size_keyx(void);
+ DLLEXPORT void __cdecl cpp_get_keyx(HANDLE,byte*); // get crypto key
+ DLLEXPORT void __cdecl cpp_set_keyx(HANDLE,byte*); // set crypto key
+ DLLEXPORT int __cdecl cpp_size_keyp(void);
+ DLLEXPORT void __cdecl cpp_get_keyp(HANDLE,byte*); // get pre-shared key
+ DLLEXPORT void __cdecl cpp_set_keyp(HANDLE,byte*); // set pre-shared key
+ DLLEXPORT int __cdecl cpp_keya(HANDLE); // KeyA exist ?
+ DLLEXPORT int __cdecl cpp_keyb(HANDLE); // KeyB exist ?
+ DLLEXPORT int __cdecl cpp_keyx(HANDLE); // KeyX exist ?
+ DLLEXPORT int __cdecl cpp_keyp(HANDLE); // KeyP exist ?
+
+ DLLEXPORT int __cdecl pgp_init(void);
+ DLLEXPORT int __cdecl pgp_done(void);
+ DLLEXPORT int __cdecl pgp_open_keyrings(LPSTR,LPSTR);
+ DLLEXPORT int __cdecl pgp_close_keyrings(void);
+ DLLEXPORT int __cdecl pgp_get_version(void);
+ DLLEXPORT LPSTR __cdecl pgp_get_error(void);
+ DLLEXPORT int __cdecl pgp_set_priv_key(LPCSTR);
+ DLLEXPORT int __cdecl pgp_set_key(HANDLE,LPCSTR);
+ DLLEXPORT int __cdecl pgp_set_keyid(HANDLE,PVOID);
+ DLLEXPORT int __cdecl pgp_size_keyid(void);
+ DLLEXPORT PVOID __cdecl pgp_select_keyid(HWND,LPSTR);
+ DLLEXPORT LPSTR __cdecl pgp_encode(HANDLE,LPCSTR);
+ DLLEXPORT LPSTR __cdecl pgp_decode(HANDLE,LPCSTR);
+
+ DLLEXPORT int __cdecl gpg_init(void);
+ DLLEXPORT int __cdecl gpg_done(void);
+ DLLEXPORT int __cdecl gpg_open_keyrings(LPSTR,LPSTR);
+ DLLEXPORT int __cdecl gpg_close_keyrings(void);
+ DLLEXPORT void __cdecl gpg_set_log(LPCSTR);
+ DLLEXPORT void __cdecl gpg_set_tmp(LPCSTR);
+ DLLEXPORT LPSTR __cdecl gpg_get_error(void);
+ DLLEXPORT int __cdecl gpg_set_key(HANDLE,LPCSTR);
+ DLLEXPORT int __cdecl gpg_set_keyid(HANDLE,LPCSTR);
+ DLLEXPORT int __cdecl gpg_size_keyid(void);
+ DLLEXPORT int __cdecl gpg_select_keyid(HWND,LPSTR);
+ DLLEXPORT LPSTR __cdecl gpg_encode(HANDLE,LPCSTR);
+ DLLEXPORT LPSTR __cdecl gpg_decode(HANDLE,LPCSTR);
+ DLLEXPORT LPSTR __cdecl gpg_get_passphrases();
+ DLLEXPORT void __cdecl gpg_set_passphrases(LPCSTR);
+
+ DLLEXPORT int __cdecl rsa_init(pRSA_EXPORT*,pRSA_IMPORT);
+ DLLEXPORT int __cdecl rsa_done(void);
+}
+
+// EOF
diff --git a/plugins/CryptoPP/src/cpp_cntx.cpp b/plugins/CryptoPP/src/cpp_cntx.cpp new file mode 100644 index 0000000000..72c35dcc96 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_cntx.cpp @@ -0,0 +1,184 @@ +#include "commonheaders.h"
+
+
+list<pCNTX> CL; // CL.size() CL.empty()
+
+HANDLE thread_timeout = 0;
+
+unsigned __stdcall sttTimeoutThread(LPVOID);
+
+
+// get context data on context id
+pCNTX get_context_on_id(HANDLE context) {
+
+ if ( !thread_timeout ) {
+ unsigned int tID;
+ thread_timeout = (HANDLE) _beginthreadex(NULL, 0, sttTimeoutThread, NULL, 0, &tID);
+ }
+
+ if ( context ) {
+ pCNTX cntx = (pCNTX) context;
+ if ( cntx->header == HEADER && cntx->footer == FOOTER )
+ return cntx;
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ else
+ Sent_NetLog("get_context_on_id: corrupted context %08X", cntx);
+#endif
+ }
+ return NULL;
+}
+
+/*
+pCNTX get_context_on_id(HANDLE context) {
+ return get_context_on_id((int)context);
+}
+*/
+
+// create context, return context id
+HANDLE __cdecl cpp_create_context(int mode) {
+
+ list<pCNTX>::iterator i;
+ pCNTX cntx = NULL;
+
+ EnterCriticalSection(&localContextMutex);
+
+ if ( !CL.empty() ) {
+ for(i=CL.begin(); i!=CL.end(); ++i) { // ищем пустой
+ if ( (*i)->header==EMPTYH && (*i)->footer==EMPTYH ) {
+ cntx = (pCNTX) *i;
+ break;
+ }
+ }
+ }
+
+ if ( !cntx ) { // не нашли - создаем новый
+ cntx = (pCNTX) malloc(sizeof(CNTX));
+ CL.push_back(cntx); // добавили в конец списка
+ }
+
+ memset(cntx,0,sizeof(CNTX)); // очищаем выделенный блок
+ cntx->header = HEADER;
+ cntx->footer = FOOTER;
+ cntx->mode = mode;
+
+ LeaveCriticalSection(&localContextMutex);
+
+ return (HANDLE)cntx;
+}
+
+
+// delete context
+void __cdecl cpp_delete_context(HANDLE context) {
+
+ pCNTX tmp = get_context_on_id(context);
+ if (tmp) { // помечаем на удаление
+ tmp->deleted = gettime()+10; // будет удален через 10 секунд
+ }
+}
+
+
+// reset context
+void __cdecl cpp_reset_context(HANDLE context) {
+
+ pCNTX tmp = get_context_on_id(context);
+ if (tmp) cpp_free_keys(tmp);
+}
+
+
+// allocate pdata
+PBYTE cpp_alloc_pdata(pCNTX ptr) {
+ if ( !ptr->pdata ) {
+ if ( ptr->mode & MODE_PGP ) {
+ ptr->pdata = (PBYTE) malloc(sizeof(PGPDATA));
+ memset(ptr->pdata,0,sizeof(PGPDATA));
+ }
+ else
+ if ( ptr->mode & MODE_GPG ) {
+ ptr->pdata = (PBYTE) malloc(sizeof(GPGDATA));
+ memset(ptr->pdata,0,sizeof(GPGDATA));
+ }
+ else
+ if ( ptr->mode & MODE_RSA ) {
+ rsa_alloc(ptr);
+ }
+ else {
+ ptr->pdata = (PBYTE) malloc(sizeof(SIMDATA));
+ memset(ptr->pdata,0,sizeof(SIMDATA));
+ }
+ }
+ return ptr->pdata;
+}
+
+
+// free memory from keys
+void cpp_free_keys(pCNTX ptr) {
+
+ SAFE_FREE(ptr->tmp);
+ cpp_alloc_pdata(ptr);
+ if ( ptr->mode & MODE_PGP ) {
+ pPGPDATA p = (pPGPDATA) ptr->pdata;
+ SAFE_FREE(p->pgpKeyID);
+ SAFE_FREE(p->pgpKey);
+ SAFE_FREE(ptr->pdata);
+ }
+ else
+ if ( ptr->mode & MODE_GPG ) {
+ pGPGDATA p = (pGPGDATA) ptr->pdata;
+ SAFE_FREE(p->gpgKeyID);
+ SAFE_FREE(ptr->pdata);
+ }
+ else
+ if ( ptr->mode & MODE_RSA ) {
+ rsa_free(ptr);
+ SAFE_DELETE(ptr->pdata);
+ }
+ else {
+ pSIMDATA p = (pSIMDATA) ptr->pdata;
+ SAFE_FREE(p->PubA);
+ SAFE_FREE(p->KeyA);
+ SAFE_FREE(p->KeyB);
+ SAFE_FREE(p->KeyX);
+ SAFE_FREE(p->KeyP);
+ SAFE_DELETE(p->dh);
+ SAFE_FREE(ptr->pdata);
+ }
+}
+
+
+// search not established RSA/AES contexts && clear deleted contexts
+unsigned __stdcall sttTimeoutThread( LPVOID ) {
+
+ list<pCNTX>::iterator i;
+ while(1) {
+ Sleep( 1000 ); // раз в секунду
+ if ( CL.empty() ) continue;
+ u_int time = gettime();
+ // пробегаем все контексты
+ EnterCriticalSection(&localContextMutex);
+ for(i=CL.begin(); i!=CL.end(); ++i) {
+ pCNTX tmp = *i;
+ if ( tmp->header!=HEADER || tmp->footer!=FOOTER ) continue;
+ // пропускаем приватные ключи
+ if ( tmp->mode&MODE_PRIV_KEY ) continue;
+ else
+ if ( tmp->deleted && tmp->deleted < time ) {
+ // удалить помеченный для удаления контекст
+ cpp_free_keys(tmp);
+ tmp->deleted = 0;
+ tmp->header = tmp->footer = EMPTYH;
+ }
+ else
+ if ( tmp->mode&MODE_RSA && tmp->pdata ) {
+ // проверяем не протухло ли соединение
+ pRSADATA p = (pRSADATA) tmp->pdata;
+ if ( p->time && p->time < time ) {
+ rsa_timeout((HANDLE)tmp,p);
+ }
+ }
+ } // for
+ LeaveCriticalSection(&localContextMutex);
+ } //while
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/cpp_gpgw.cpp b/plugins/CryptoPP/src/cpp_gpgw.cpp new file mode 100644 index 0000000000..0ef3d77626 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_gpgw.cpp @@ -0,0 +1,334 @@ +#include "commonheaders.h"
+
+
+HMODULE hgpg;
+HRSRC hRS_gpg;
+PBYTE pRS_gpg;
+
+extern DLLEXPORT int __cdecl _gpg_init(void);
+extern DLLEXPORT int __cdecl _gpg_done(void);
+extern DLLEXPORT int __cdecl _gpg_open_keyrings(LPSTR,LPSTR);
+extern DLLEXPORT int __cdecl _gpg_close_keyrings(void);
+extern DLLEXPORT void __cdecl _gpg_set_log(LPCSTR);
+extern DLLEXPORT void __cdecl _gpg_set_tmp(LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_get_error(void);
+extern DLLEXPORT int __cdecl _gpg_size_keyid(void);
+extern DLLEXPORT int __cdecl _gpg_select_keyid(HWND,LPSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_encrypt(LPCSTR,LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_decrypt(LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_get_passphrases();
+extern DLLEXPORT void __cdecl _gpg_set_passphrases(LPCSTR);
+
+int __cdecl _gpg_init(void);
+int __cdecl _gpg_done(void);
+int __cdecl _gpg_open_keyrings(LPSTR,LPSTR);
+int __cdecl _gpg_close_keyrings(void);
+void __cdecl _gpg_set_log(LPCSTR);
+void __cdecl _gpg_set_tmp(LPCSTR);
+LPSTR __cdecl _gpg_get_error(void);
+int __cdecl _gpg_size_keyid(void);
+int __cdecl _gpg_select_keyid(HWND,LPSTR);
+LPSTR __cdecl _gpg_encrypt(LPCSTR,LPCSTR);
+LPSTR __cdecl _gpg_decrypt(LPCSTR);
+LPSTR __cdecl _gpg_get_passphrases();
+void __cdecl _gpg_set_passphrases(LPCSTR);
+
+int (__cdecl *p_gpg_init)(void);
+int (__cdecl *p_gpg_done)(void);
+int (__cdecl *p_gpg_open_keyrings)(LPSTR,LPSTR);
+int (__cdecl *p_gpg_close_keyrings)(void);
+void (__cdecl *p_gpg_set_log)(LPCSTR);
+void (__cdecl *p_gpg_set_tmp)(LPCSTR);
+LPSTR (__cdecl *p_gpg_get_error)(void);
+int (__cdecl *p_gpg_size_keyid)(void);
+int (__cdecl *p_gpg_select_keyid)(HWND,LPSTR);
+LPSTR (__cdecl *p_gpg_encrypt)(LPCSTR,LPCSTR);
+LPSTR (__cdecl *p_gpg_decrypt)(LPCSTR);
+LPSTR (__cdecl *p_gpg_get_passphrases)();
+void (__cdecl *p_gpg_set_passphrases)(LPCSTR);
+
+
+#define GPA(x) \
+ { \
+ *((PVOID*)&p##x) = (PVOID)GetProcAddress(mod, TEXT(#x)); \
+ if (!p##x) { \
+ return 0; \
+ } \
+ }
+
+int load_gpg_dll(HMODULE mod) {
+
+ GPA(_gpg_init);
+ GPA(_gpg_done);
+ GPA(_gpg_open_keyrings);
+ GPA(_gpg_close_keyrings);
+ GPA(_gpg_set_log);
+ GPA(_gpg_set_tmp);
+ GPA(_gpg_get_error);
+ GPA(_gpg_size_keyid);
+ GPA(_gpg_select_keyid);
+ GPA(_gpg_encrypt);
+ GPA(_gpg_decrypt);
+ GPA(_gpg_get_passphrases);
+ GPA(_gpg_set_passphrases);
+
+ return 1;
+}
+
+#undef GPA
+
+
+#define GPA(x) \
+ { \
+ *((PVOID*)&p##x) = (PVOID)MemGetProcAddress(mod, TEXT(#x)); \
+ if (!p##x) { \
+ return 0; \
+ } \
+ }
+
+int load_gpg_mem(HMODULE mod) {
+
+ GPA(_gpg_init);
+ GPA(_gpg_done);
+ GPA(_gpg_open_keyrings);
+ GPA(_gpg_close_keyrings);
+ GPA(_gpg_set_log);
+ GPA(_gpg_set_tmp);
+ GPA(_gpg_get_error);
+ GPA(_gpg_size_keyid);
+ GPA(_gpg_select_keyid);
+ GPA(_gpg_encrypt);
+ GPA(_gpg_decrypt);
+ GPA(_gpg_get_passphrases);
+ GPA(_gpg_set_passphrases);
+
+ return 1;
+}
+
+#undef GPA
+
+
+int __cdecl gpg_init()
+{
+ int r; char t[MAX_PATH];
+ if ( isVista ) {
+ sprintf(t,"%s\\gnupgw.dll",TEMP);
+ ExtractFile(t,666,1);
+ hgpg = LoadLibraryA(t);
+ }
+ else {
+ hRS_gpg = FindResource( g_hInst, MAKEINTRESOURCE(1), MAKEINTRESOURCE(666) );
+ pRS_gpg = (PBYTE) LoadResource( g_hInst, hRS_gpg ); LockResource( pRS_gpg );
+ hgpg = MemLoadLibrary( pRS_gpg );
+ }
+ if (hgpg) {
+ if ( isVista ) load_gpg_dll(hgpg);
+ else load_gpg_mem(hgpg);
+ r = p_gpg_init();
+ if (r) {
+ return r;
+ }
+ if ( isVista ) {
+ FreeLibrary(hgpg);
+ }
+ else {
+ MemFreeLibrary(hgpg);
+ UnlockResource( pRS_gpg );
+ FreeResource( pRS_gpg );
+ }
+ }
+
+ hgpg = 0;
+
+ return 0;
+}
+
+
+int __cdecl gpg_done()
+{
+ int r = 0;
+ if (hgpg) {
+ r = p_gpg_done();
+ if ( isVista ) {
+ FreeLibrary(hgpg);
+ }
+ else {
+ MemFreeLibrary(hgpg);
+ UnlockResource( pRS_gpg );
+ FreeResource( pRS_gpg );
+ }
+ hgpg = 0;
+ }
+ return r;
+}
+
+
+int __cdecl gpg_open_keyrings(LPSTR ExecPath, LPSTR HomePath)
+{
+ return p_gpg_open_keyrings(ExecPath, HomePath);
+}
+
+
+int __cdecl gpg_close_keyrings()
+{
+ return p_gpg_close_keyrings();
+}
+
+
+void __cdecl gpg_set_log(LPCSTR LogPath)
+{
+ p_gpg_set_log(LogPath);
+}
+
+
+void __cdecl gpg_set_tmp(LPCSTR TmpPath)
+{
+ p_gpg_set_tmp(TmpPath);
+}
+
+
+LPSTR __cdecl gpg_get_error()
+{
+ return p_gpg_get_error();
+}
+
+
+LPSTR __cdecl gpg_encrypt(pCNTX ptr, LPCSTR szPlainMsg)
+{
+ ptr->error = ERROR_NONE;
+ pGPGDATA p = (pGPGDATA) ptr->pdata;
+ SAFE_FREE(ptr->tmp);
+
+ LPSTR szEncMsg;
+ szEncMsg = p_gpg_encrypt(szPlainMsg,(LPCSTR)p->gpgKeyID);
+ if (!szEncMsg) return 0;
+
+ ptr->tmp = (LPSTR)_strdup(szEncMsg);
+ LocalFree((LPVOID)szEncMsg);
+
+ return ptr->tmp;
+}
+
+
+LPSTR __cdecl gpg_decrypt(pCNTX ptr, LPCSTR szEncMsg)
+{
+ ptr->error = ERROR_NONE;
+ SAFE_FREE(ptr->tmp);
+
+ LPSTR szPlainMsg = p_gpg_decrypt(szEncMsg);
+/* if (!szPlainMsg) {
+ ptr = get_context_on_id(hPGPPRIV); // find private pgp keys
+ if (ptr && ptr->pgpKey)
+ szPlainMsg = p_gpg_decrypt_key(szEncMsg,(LPCSTR)ptr->pgpKey);
+ if (!szPlainMsg) return NULL;
+ }*/
+
+ ptr->tmp = (LPSTR)_strdup(szPlainMsg);
+ LocalFree((LPVOID)szPlainMsg);
+
+ return ptr->tmp;
+}
+
+
+LPSTR __cdecl gpg_encode(HANDLE context, LPCSTR szPlainMsg)
+{
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return NULL;
+ pGPGDATA p = (pGPGDATA) cpp_alloc_pdata(ptr);
+ if (!p->gpgKeyID) { ptr->error = ERROR_NO_GPG_KEY; return NULL; }
+
+ // utf8 message: encrypt.
+ LPSTR szUtfMsg;
+ if ( ptr->mode & MODE_GPG_ANSI ) {
+ LPWSTR wszMsg = utf8decode(szPlainMsg);
+ size_t wlen = wcslen(wszMsg)+1;
+ szUtfMsg = (LPSTR) alloca(wlen);
+ WideCharToMultiByte(CP_ACP, 0, wszMsg, -1, szUtfMsg, wlen, 0, 0);
+ }
+ else {
+ szUtfMsg = (LPSTR)szPlainMsg;
+ }
+ return gpg_encrypt(ptr, szUtfMsg);
+}
+
+
+LPSTR __cdecl gpg_decode(HANDLE context, LPCSTR szEncMsg)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return NULL;
+
+ LPSTR szNewMsg = NULL;
+ LPSTR szOldMsg = gpg_decrypt(ptr, szEncMsg);
+
+ if (szOldMsg) {
+ if ( !is_7bit_string(szOldMsg) && !is_utf8_string(szOldMsg) ) {
+ size_t slen = strlen(szOldMsg)+1;
+ LPWSTR wszMsg = (LPWSTR) alloca(slen*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wszMsg, slen*sizeof(WCHAR));
+ szNewMsg = _strdup(utf8encode(wszMsg));
+ }
+ else {
+ szNewMsg = _strdup(szOldMsg);
+ }
+ }
+ SAFE_FREE(ptr->tmp);
+ ptr->tmp = szNewMsg;
+ return szNewMsg;
+}
+
+
+int __cdecl gpg_set_key(HANDLE context, LPCSTR RemoteKey)
+{
+/* pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return 0;
+ ptr->error = ERROR_NONE;
+
+// if (!p_gpg_check_key(RemoteKey)) return 0;
+
+ SAFE_FREE(ptr->pgpKey);
+ ptr->pgpKey = (BYTE *) malloc(strlen(RemoteKey)+1);
+ strcpy((LPSTR)ptr->pgpKey,RemoteKey);
+
+ return 1;
+*/
+ return 0;
+}
+
+
+int __cdecl gpg_set_keyid(HANDLE context, LPCSTR RemoteKeyID)
+{
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pGPGDATA p = (pGPGDATA) cpp_alloc_pdata(ptr);
+ ptr->error = ERROR_NONE;
+
+ SAFE_FREE(p->gpgKeyID);
+ p->gpgKeyID = (PBYTE)_strdup(RemoteKeyID);
+
+ return 1;
+}
+
+
+int __cdecl gpg_size_keyid()
+{
+ return p_gpg_size_keyid();
+}
+
+
+int __cdecl gpg_select_keyid(HWND hDlg,LPSTR szKeyID)
+{
+ return p_gpg_select_keyid(hDlg,szKeyID);
+}
+
+
+LPSTR __cdecl gpg_get_passphrases()
+{
+ return p_gpg_get_passphrases();
+}
+
+
+void __cdecl gpg_set_passphrases(LPCSTR buffer)
+{
+ p_gpg_set_passphrases(buffer);
+}
+
+
+// EOF
\ No newline at end of file diff --git a/plugins/CryptoPP/src/cpp_gzip.cpp b/plugins/CryptoPP/src/cpp_gzip.cpp new file mode 100644 index 0000000000..36a4ae7e20 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_gzip.cpp @@ -0,0 +1,57 @@ +#include "commonheaders.h"
+
+// gzip data
+BYTE *cpp_gzip(BYTE *pData, size_t nLen, size_t& nCompressedLen) {
+
+ string zipped;
+ Gzip gzip(new StringSink(zipped),5); // 1 is fast, 9 is slow
+ gzip.Put(pData, nLen);
+ gzip.MessageEnd();
+
+ nCompressedLen = (int) zipped.length();
+ PBYTE pCompressed = (PBYTE) malloc(nCompressedLen+1);
+ memcpy(pCompressed,zipped.data(),nCompressedLen);
+
+ return pCompressed;
+}
+
+// gunzip data
+BYTE *cpp_gunzip(BYTE *pCompressedData, size_t nCompressedLen, size_t& nLen) {
+
+ string unzipped;
+ Gunzip gunzip(new StringSink(unzipped));
+ gunzip.Put((PBYTE)pCompressedData,nCompressedLen);
+ gunzip.MessageEnd();
+
+ nLen = (int) unzipped.length();
+ PBYTE pData = (PBYTE) malloc(nLen+1);
+ memcpy(pData,unzipped.data(),nLen);
+
+ return pData;
+}
+
+// zlibc data
+string cpp_zlibc(string& pData) {
+
+ string zipped;
+
+ ZlibCompressor zlib(new StringSink(zipped),5); // 1 is fast, 9 is slow
+ zlib.Put((PBYTE)pData.data(), pData.length());
+ zlib.MessageEnd();
+
+ return zipped;
+}
+
+// zlibd data
+string cpp_zlibd(string& pData) {
+
+ string unzipped;
+
+ ZlibDecompressor zlib(new StringSink(unzipped));
+ zlib.Put((PBYTE)pData.data(),pData.length());
+ zlib.MessageEnd();
+
+ return unzipped;
+}
+
+// EOF
diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp new file mode 100644 index 0000000000..b216eb6a2f --- /dev/null +++ b/plugins/CryptoPP/src/cpp_keys.cpp @@ -0,0 +1,199 @@ +#include "commonheaders.h"
+
+const unsigned char IV[] = "PSKhell@MIRANDA!";
+
+
+// generate KeyA pair, return public key as ASCII
+LPSTR __cdecl cpp_init_keya(HANDLE context, int features) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return NULL;
+ pSIMDATA p = (pSIMDATA) cpp_alloc_pdata(ptr);
+
+ int send_features = FEATURES;
+ if (p->KeyP) send_features |= FEATURES_PSK;
+
+ SAFE_DELETE(p->dh);
+ if (features & FEATURES_NEWPG) {
+ Integer p0("0x865734026113B4DF0082CED84C197718516088FBDA406CFDFD7F033694E11E46F01C8F01E0E5AE6B09F6284691C7DD30A5BA8A74BA4B780198624B84BC8DAF6E0DFF874C0440ABB5C043C82E9E9C9E6F1A470B6A2A6BCEAC9460C43B1BB1331DF0FFD898DB74D22E8A71DB2659F1B0F52F337718D233DED611DA25AEAA90F3BE0C42FA9E541D0487DF58A77E2F44D295AD0C54C369CE260C969CA12F690EAAFAEEF8676C631AF29A3DE3389D3000B94EFA775E31FCA879AEB00A4D05EEF50D4C084A049EB12EF4CDFBD48E36B29CEAF8978D535D6C70BB274D1FEA02ABD521D2EF482A76326C17AF597FCB9B8BF37D9110E22AB0746D6A9779DF5133822E3F15");
+ Integer q0("0xF1515160E1BFC7636338C13AD5BA775318E287147A1F96B73CF0FB4D97EFFB9D1FCDCF31AB9D92C4F49C9F8D50F06E697D2313E2EBAC7781312A51F458D66FFC687960CAA86BDF150A36ED53D79FBDB4F501FD25E37C181B45F9555D7F1C6124CAB29A822AD1E7BF5DA93C2FDB12A61919B5E5359793CBB16E71516919040A7F");
+ Integer g0("0x434158F2FF2CF667E3CC1A707770DDE7B56048F6C5005473C6DC4A5E3FC490667F2908C44F9ADC2071EB8A8A1EC6AD6901CDAAAFE806626E3F4C5E69D4FCBF9DF1B67D574DC61C687C4BEF3ACF77A7256752F4D3A7EAEEE5874ED4912AB10C5B122A24E698B14CAC3E0FD006E0DB02714E028AECCA25BAB9DDCA2CF6405E862B403C61BC381D64B46BD96D3FEFBE22B7497FCBDA2B49C840C1B2853502A5216B036F83D2EAD8F835B603FC5BA1EFB816C7634915B1D43963FDD1B1ED626F48CCF8F152392E4693D38C566016708FA9E9598AECF95A8B067212669247552418E538A706564F855D3D5D50717D356259A20D8FD0C6B2A9FCC045D3F7AED1E857C5");
+ p->dh = new DH(p0,q0,g0);
+ }
+ else {
+ Integer p0("0xD494AAFBCD2EAC6A36DB8E7DD4A2A64512A5BBB15B9BFB581C7C1CAFB647D4612973C3770C2166D75EEA695F67EA8261557591DB78BCF5A886AA5294F3AEE4D25B57C8EE8C7FE8DBF70C132CD7FFCB6F89426F807F552C5DAE2FB1F329E340094E4B30D8EF6265AB4D350E9837B151C86AC524DE4E1FC04746C668BE318275E420D51AEDDFBDF887D435CDEEF6AC81293DB45287132F8236A43AD8F4D6642D7CA6732DA06A1DE008259008C9D74403B68ADAC788CF8AB5BEFFC310DCCCD32901D1F290E5B7A993D2CF6A652AF81B6DA0FD2E70678D1AE086150E41444522F20621195AD2A1F0975652B4AF7DE5261A9FD46B9EA8B443641F3BBA695B9B020103");
+ Integer g0("0x12A567BC9ABCDEF1234567823BCDEF1E");
+ p->dh = new DH(p0,g0);
+ }
+
+ BYTE priv1[KEYSIZE]; // private key of 2048 bit
+ BYTE publ1[KEYSIZE+2]; // public key of 2048 bit + faetures field
+
+ memset(priv1,0,sizeof(priv1));
+ memset(publ1,0,sizeof(publ1));
+
+ AutoSeededRandomPool autorng;
+ p->dh->GenerateKeyPair(autorng, priv1, publ1);
+
+ SAFE_FREE(p->PubA);
+ p->PubA = (PBYTE) malloc(KEYSIZE);
+ memcpy(p->PubA,publ1,KEYSIZE);
+
+ SAFE_FREE(p->KeyA);
+ p->KeyA = (PBYTE) malloc(KEYSIZE);
+ memcpy(p->KeyA,priv1,KEYSIZE);
+
+ if (p->KeyP) {
+ // encrypt PUBLIC use PSK
+ string ciphered;
+ CFB_Mode<AES>::Encryption enc(p->KeyP,Tiger::DIGESTSIZE,IV);
+ StreamTransformationFilter cbcEncryptor(enc,new StringSink(ciphered));
+
+ cbcEncryptor.Put(publ1,KEYSIZE);
+ cbcEncryptor.MessageEnd();
+ memcpy(publ1,ciphered.data(),ciphered.length());
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_init_keya: %d %d",KEYSIZE,ciphered.length());
+#endif
+ }
+ memcpy((PVOID)&publ1[KEYSIZE],(PVOID)&send_features,2);
+
+ SAFE_FREE(ptr->tmp);
+ if (ptr->mode & MODE_BASE64 || features & FEATURES_NEWPG)
+ ptr->tmp = base64encode((LPSTR)&publ1,KEYSIZE+2);
+ else
+ ptr->tmp = base16encode((LPSTR)&publ1,KEYSIZE+2);
+
+ return ptr->tmp;
+}
+
+
+// store KeyB
+int __cdecl cpp_init_keyb(HANDLE context, LPCSTR key) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pSIMDATA p = (pSIMDATA) cpp_alloc_pdata(ptr);
+
+ size_t clen = rtrim(key);
+ ptr->features = 0;
+
+ LPSTR pub_binary;
+ if ((clen==KEYSIZE*2) || (clen==(KEYSIZE+2)*2))
+ pub_binary = base16decode(key,&clen);
+ else
+ pub_binary = base64decode(key,&clen);
+
+ if ( !pub_binary || (clen!=KEYSIZE && clen!=KEYSIZE+2) ) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_init_keyb: error bad_keyb");
+#endif
+ ptr->error = ERROR_BAD_KEYB;
+ SAFE_FREE(pub_binary);
+ return 0;
+ }
+
+ if (clen==KEYSIZE+2)
+ memcpy((PVOID)&ptr->features,(PVOID)(pub_binary+KEYSIZE),2);
+
+ if (p->KeyP) {
+ if (!(ptr->features & FEATURES_PSK)) { // if NO PSK on other side
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_init_keyb: error no_psk");
+#endif
+ ptr->error = ERROR_NO_PSK;
+ return 0;
+ }
+ ptr->error = ERROR_BAD_PSK;
+ try {
+ // decrypt PUBLIC use PSK
+ string unciphered;
+ CFB_Mode<AES>::Decryption dec(p->KeyP,Tiger::DIGESTSIZE,IV);
+ StreamTransformationFilter cbcDecryptor(dec,new StringSink(unciphered));
+
+ cbcDecryptor.Put((PBYTE)pub_binary,KEYSIZE);
+ cbcDecryptor.MessageEnd();
+ memcpy(pub_binary,unciphered.data(),unciphered.length());
+ }
+ catch (...) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_init_keyb: error bad_psk");
+#endif
+ return 0;
+ }
+ }
+
+ SAFE_FREE(p->KeyB);
+ p->KeyB = (PBYTE) pub_binary;
+
+ if (p->PubA && memcmp(p->PubA,p->KeyB,KEYSIZE)==0) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_init_keyb: error bad_keyb keya==keyb");
+#endif
+ SAFE_FREE(p->KeyB);
+ ptr->error = ERROR_BAD_KEYB;
+ return 0;
+ }
+
+ ptr->error = ERROR_NONE;
+ return 1;
+}
+
+
+// calculate secret key, return true or false
+int __cdecl cpp_calc_keyx(HANDLE context) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pSIMDATA p = (pSIMDATA) cpp_alloc_pdata(ptr);
+
+ if (!p->KeyA) { ptr->error = ERROR_NO_KEYA; return 0; }
+ if (!p->KeyB) { ptr->error = ERROR_NO_KEYB; return 0; }
+ ptr->error = ERROR_NONE;
+
+ BYTE agreeVal[KEYSIZE];
+ memset(agreeVal,0,sizeof(agreeVal));
+
+ BYTE agr = p->dh->Agree(agreeVal, p->KeyA, p->KeyB, true); // calculate key
+ if (agr) {
+ // not needed anymore
+ SAFE_FREE(p->PubA);
+ SAFE_FREE(p->KeyA);
+ SAFE_FREE(p->KeyB);
+// SAFE_DELETE(p->dh);
+
+ BYTE buffer[Tiger::DIGESTSIZE]; // buffer for hash
+ memset(buffer,0,sizeof(buffer));
+
+ // do this only if key exchanged is ok
+ // we use a 192bit key (24*8)
+ Tiger().CalculateDigest(buffer, agreeVal, KEYSIZE); // calculate hash
+
+ // store key
+ SAFE_FREE(p->KeyX);
+ p->KeyX = (PBYTE) malloc(Tiger::DIGESTSIZE);
+ memcpy(p->KeyX,buffer,Tiger::DIGESTSIZE);
+ }
+ return (int)agr;
+}
+
+
+// create pre-shared key from password
+int __cdecl cpp_init_keyp(HANDLE context, LPCSTR password) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pSIMDATA p = (pSIMDATA) cpp_alloc_pdata(ptr);
+
+ BYTE buffer[Tiger::DIGESTSIZE]; // buffer for hash
+ memset(buffer,0,sizeof(buffer));
+
+ // calculate hash
+ Tiger().CalculateDigest(buffer,(PBYTE)password,strlen(password));
+
+ // store pre-shared key
+ SAFE_FREE(p->KeyP);
+ p->KeyP = (PBYTE) malloc(Tiger::DIGESTSIZE);
+ memcpy(p->KeyP,buffer,Tiger::DIGESTSIZE);
+
+ return 1;
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/cpp_misc.cpp b/plugins/CryptoPP/src/cpp_misc.cpp new file mode 100644 index 0000000000..5e5720df18 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_misc.cpp @@ -0,0 +1,97 @@ +#include "commonheaders.h"
+
+
+int __cdecl cpp_get_features(HANDLE context) {
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ return ptr->features;
+}
+
+
+int __cdecl cpp_get_error(HANDLE context) {
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ return ptr->error;
+}
+
+
+int __cdecl cpp_get_version(void) {
+ return __VERSION_DWORD;
+}
+
+
+BOOL cpp_get_simdata(HANDLE context, pCNTX *ptr, pSIMDATA *p) {
+ *ptr = get_context_on_id(context);
+// if (!*ptr || !(*ptr)->pdata || (*ptr)->mode&(MODE_PGP|MODE_GPG|MODE_RSA)) return FALSE;
+ if (!*ptr || (*ptr)->mode&(MODE_PGP|MODE_GPG|MODE_RSA)) return FALSE;
+ *p = (pSIMDATA) cpp_alloc_pdata(*ptr);
+ return TRUE;
+}
+
+
+int __cdecl cpp_size_keyx(void) {
+ return(Tiger::DIGESTSIZE+2);
+}
+
+
+void __cdecl cpp_get_keyx(HANDLE context, BYTE *key) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return;
+ memcpy(key,p->KeyX,Tiger::DIGESTSIZE);
+ memcpy(key+Tiger::DIGESTSIZE,&ptr->features,2);
+}
+
+
+void __cdecl cpp_set_keyx(HANDLE context, BYTE *key) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return;
+ SAFE_FREE(p->PubA);
+ SAFE_FREE(p->KeyA);
+ SAFE_FREE(p->KeyB);
+ SAFE_FREE(p->KeyX);
+ p->KeyX = (PBYTE) malloc(Tiger::DIGESTSIZE+2);
+ memcpy(p->KeyX,key,Tiger::DIGESTSIZE);
+ memcpy(&ptr->features,key+Tiger::DIGESTSIZE,2);
+}
+
+
+void __cdecl cpp_get_keyp(HANDLE context, BYTE *key) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return;
+ memcpy(key,p->KeyP,Tiger::DIGESTSIZE);
+}
+
+
+int __cdecl cpp_size_keyp(void) {
+ return(Tiger::DIGESTSIZE);
+}
+
+
+void __cdecl cpp_set_keyp(HANDLE context, BYTE *key) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return;
+ SAFE_FREE(p->KeyP);
+ p->KeyP = (PBYTE) malloc(Tiger::DIGESTSIZE);
+ memcpy(p->KeyP,key,Tiger::DIGESTSIZE);
+}
+
+
+int __cdecl cpp_keya(HANDLE context) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return 0;
+ return p->KeyA!=NULL;
+}
+
+
+int __cdecl cpp_keyb(HANDLE context) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return 0;
+ return p->KeyB!=NULL;
+}
+
+
+int __cdecl cpp_keyx(HANDLE context) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return 0;
+ return p->KeyX!=NULL;
+}
+
+
+int __cdecl cpp_keyp(HANDLE context) {
+ pCNTX ptr; pSIMDATA p; if (!cpp_get_simdata(context,&ptr,&p)) return 0;
+ return p->KeyP!=NULL;
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/cpp_pgpw.cpp b/plugins/CryptoPP/src/cpp_pgpw.cpp new file mode 100644 index 0000000000..8633690009 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_pgpw.cpp @@ -0,0 +1,317 @@ +#include "commonheaders.h"
+
+
+HMODULE hpgpsdk;
+UINT pgpVer;
+HRSRC hRS_pgp;
+PBYTE pRS_pgp;
+
+
+int __cdecl _pgp_init(void);
+int __cdecl _pgp_done(void);
+int __cdecl _pgp_open_keyrings(LPSTR,LPSTR);
+int __cdecl _pgp_close_keyrings(void);
+int __cdecl _pgp_get_version(void);
+LPSTR __cdecl _pgp_get_error(void);
+int __cdecl _pgp_size_keyid(void);
+PVOID __cdecl _pgp_select_keyid(HWND,LPSTR);
+LPSTR __cdecl _pgp_encrypt_keydb(LPCSTR,PVOID);
+LPSTR __cdecl _pgp_decrypt_keydb(LPCSTR);
+//int __cdecl _pgp_check_key(LPCSTR);
+LPSTR __cdecl _pgp_encrypt_key(LPCSTR,LPCSTR);
+LPSTR __cdecl _pgp_decrypt_key(LPCSTR,LPCSTR);
+
+int (__cdecl *p_pgp_init)(void);
+int (__cdecl *p_pgp_done)(void);
+int (__cdecl *p_pgp_open_keyrings)(LPSTR,LPSTR);
+int (__cdecl *p_pgp_close_keyrings)(void);
+int (__cdecl *p_pgp_get_version)(void);
+LPSTR (__cdecl *p_pgp_get_error)(void);
+int (__cdecl *p_pgp_size_keyid)(void);
+PVOID (__cdecl *p_pgp_select_keyid)(HWND,LPSTR);
+LPSTR (__cdecl *p_pgp_encrypt_keydb)(LPCSTR,PVOID);
+LPSTR (__cdecl *p_pgp_decrypt_keydb)(LPCSTR);
+//int (__cdecl *p_pgp_check_key)(LPCSTR);
+LPSTR (__cdecl *p_pgp_encrypt_key)(LPCSTR,LPCSTR);
+LPSTR (__cdecl *p_pgp_decrypt_key)(LPCSTR,LPCSTR);
+
+
+#define GPA(x) \
+{ \
+ *((PVOID*)&p##x) = (PVOID)GetProcAddress(mod, TEXT(#x)); \
+ if (!p##x) return 0; \
+}
+
+int load_pgpsdk_dll(HMODULE mod) {
+
+ GPA(_pgp_init);
+ GPA(_pgp_done);
+ GPA(_pgp_open_keyrings);
+ GPA(_pgp_close_keyrings);
+ GPA(_pgp_get_version);
+ GPA(_pgp_get_error);
+ GPA(_pgp_size_keyid);
+ GPA(_pgp_select_keyid);
+ GPA(_pgp_encrypt_keydb);
+ GPA(_pgp_decrypt_keydb);
+ GPA(_pgp_encrypt_key);
+ GPA(_pgp_decrypt_key);
+
+ return 1;
+}
+
+#undef GPA
+
+
+#define GPA(x) \
+{ \
+ *((PVOID*)&p##x) = (PVOID)MemGetProcAddress(mod, TEXT(#x)); \
+ if (!p##x) { \
+ return 0; \
+ } \
+}
+
+int load_pgpsdk_mem(HMODULE mod) {
+
+ GPA(_pgp_init);
+ GPA(_pgp_done);
+ GPA(_pgp_open_keyrings);
+ GPA(_pgp_close_keyrings);
+ GPA(_pgp_get_version);
+ GPA(_pgp_get_error);
+ GPA(_pgp_size_keyid);
+ GPA(_pgp_select_keyid);
+ GPA(_pgp_encrypt_keydb);
+ GPA(_pgp_decrypt_keydb);
+ GPA(_pgp_encrypt_key);
+ GPA(_pgp_decrypt_key);
+
+ return 1;
+}
+
+#undef GPA
+
+
+BOOL load_pgp_sdk(int type, int id)
+{
+ int r; char t[MAX_PATH];
+ pgpVer = 0;
+
+ if ( isVista ) {
+ sprintf(t,"%s\\pgpsdkw.dll",TEMP);
+ ExtractFile(t,type,id);
+ hpgpsdk = LoadLibraryA(t);
+ }
+ else {
+ hRS_pgp = FindResource( g_hInst, MAKEINTRESOURCE(id), MAKEINTRESOURCE(type) );
+ pRS_pgp = (PBYTE) LoadResource( g_hInst, hRS_pgp ); LockResource( pRS_pgp );
+ hpgpsdk = MemLoadLibrary( pRS_pgp );
+ }
+ if (hpgpsdk) {
+ if ( isVista ) load_pgpsdk_dll(hpgpsdk);
+ else load_pgpsdk_mem(hpgpsdk);
+ r = p_pgp_init();
+ if (r) {
+ pgpVer = p_pgp_get_version();
+ return r;
+ }
+ if ( isVista ) {
+ FreeLibrary(hpgpsdk);
+ }
+ else {
+ MemFreeLibrary(hpgpsdk);
+ UnlockResource( pRS_pgp );
+ FreeResource( pRS_pgp );
+ }
+ }
+ return 0;
+}
+
+
+int __cdecl pgp_init()
+{
+ int r;
+
+ if ( !hPGPPRIV ) {
+ // create context for private pgp keys
+ hPGPPRIV = (HANDLE) cpp_create_context(MODE_PGP|MODE_PRIV_KEY);
+ pCNTX tmp = (pCNTX) hPGPPRIV;
+ tmp->pdata = (PBYTE) malloc(sizeof(PGPDATA));
+ memset(tmp->pdata,0,sizeof(PGPDATA));
+ }
+
+ if ( r = load_pgp_sdk(666,6) ) return r;
+ if ( r = load_pgp_sdk(666,8) ) return r;
+
+ hpgpsdk = 0;
+
+ return 0;
+}
+
+
+int __cdecl pgp_done()
+{
+ int r = 0;
+ pgpVer = 0;
+ if (hpgpsdk) {
+ r = p_pgp_done();
+ if ( isVista ) {
+ FreeLibrary(hpgpsdk);
+ }
+ else {
+ MemFreeLibrary(hpgpsdk);
+ UnlockResource( pRS_pgp );
+ FreeResource( pRS_pgp );
+ }
+ hpgpsdk = 0;
+ }
+ return r;
+}
+
+
+int __cdecl pgp_open_keyrings(LPSTR PubRingPath, LPSTR SecRingPath)
+{
+ return p_pgp_open_keyrings(PubRingPath,SecRingPath);
+}
+
+
+int __cdecl pgp_close_keyrings()
+{
+ return p_pgp_close_keyrings();
+}
+
+
+int __cdecl pgp_get_version()
+{
+ return pgpVer;
+}
+
+LPSTR __cdecl pgp_get_error()
+{
+ return p_pgp_get_error();
+}
+
+LPSTR __cdecl pgp_encrypt(pCNTX ptr, LPCSTR szPlainMsg)
+{
+ ptr->error = ERROR_NONE;
+ pPGPDATA p = (pPGPDATA) ptr->pdata;
+ SAFE_FREE(ptr->tmp);
+
+ LPSTR szEncMsg;
+ if (p->pgpKey)
+ szEncMsg = p_pgp_encrypt_key(szPlainMsg,(LPCSTR)p->pgpKey);
+ else
+ szEncMsg = p_pgp_encrypt_keydb(szPlainMsg,p->pgpKeyID);
+ if (!szEncMsg) return 0;
+
+ ptr->tmp = (LPSTR) _strdup(szEncMsg);
+ LocalFree((LPVOID)szEncMsg);
+
+ return ptr->tmp;
+}
+
+
+LPSTR __cdecl pgp_decrypt(pCNTX ptr, LPCSTR szEncMsg)
+{
+ ptr->error = ERROR_NONE;
+ SAFE_FREE(ptr->tmp);
+
+ LPSTR szPlainMsg = p_pgp_decrypt_keydb(szEncMsg);
+ if (!szPlainMsg) {
+ ptr = get_context_on_id(hPGPPRIV); // find private pgp keys
+ if (ptr) {
+ pPGPDATA p = (pPGPDATA) ptr->pdata;
+ if (p->pgpKey)
+ szPlainMsg = p_pgp_decrypt_key(szEncMsg,(LPCSTR)p->pgpKey);
+ }
+ if (!szPlainMsg) return NULL;
+ }
+
+ ptr->tmp = (LPSTR) _strdup(szPlainMsg);
+ LocalFree((LPVOID)szPlainMsg);
+
+ return ptr->tmp;
+}
+
+
+LPSTR __cdecl pgp_encode(HANDLE context, LPCSTR szPlainMsg)
+{
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return NULL;
+ pPGPDATA p = (pPGPDATA) cpp_alloc_pdata(ptr);
+ if ( !p->pgpKeyID && !p->pgpKey ) {
+ ptr->error = ERROR_NO_PGP_KEY;
+ return NULL;
+ }
+
+ // utf8 message: encrypt.
+ return pgp_encrypt(ptr, szPlainMsg);
+}
+
+
+LPSTR __cdecl pgp_decode(HANDLE context, LPCSTR szEncMsg)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return NULL;
+
+ LPSTR szNewMsg = NULL;
+ LPSTR szOldMsg = pgp_decrypt(ptr, szEncMsg);
+
+ if (szOldMsg) {
+ if ( !is_7bit_string(szOldMsg) && !is_utf8_string(szOldMsg) ) {
+ size_t slen = strlen(szOldMsg)+1;
+ LPWSTR wszMsg = (LPWSTR) alloca(slen*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wszMsg, slen*sizeof(WCHAR));
+ szNewMsg = _strdup(utf8encode(wszMsg));
+ }
+ else szNewMsg = _strdup(szOldMsg);
+ }
+ SAFE_FREE(ptr->tmp);
+ ptr->tmp = szNewMsg;
+ return szNewMsg;
+}
+
+
+int __cdecl pgp_set_priv_key(LPCSTR LocalKey)
+{
+ return pgp_set_key(hPGPPRIV,LocalKey);
+}
+
+
+int __cdecl pgp_set_key(HANDLE context, LPCSTR RemoteKey)
+{
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pPGPDATA p = (pPGPDATA) cpp_alloc_pdata(ptr);
+ ptr->error = ERROR_NONE;
+
+ SAFE_FREE(p->pgpKey);
+ p->pgpKey = (PBYTE) _strdup(RemoteKey);
+
+ return 1;
+}
+
+
+int __cdecl pgp_set_keyid(HANDLE context, PVOID RemoteKeyID)
+{
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pPGPDATA p = (pPGPDATA) cpp_alloc_pdata(ptr);
+ ptr->error = ERROR_NONE;
+
+ SAFE_FREE(p->pgpKeyID);
+ p->pgpKeyID = (PBYTE) malloc(p_pgp_size_keyid());
+ memcpy(p->pgpKeyID,RemoteKeyID,p_pgp_size_keyid());
+
+ return 1;
+}
+
+
+int __cdecl pgp_size_keyid()
+{
+ return p_pgp_size_keyid();
+}
+
+
+PVOID __cdecl pgp_select_keyid(HWND hDlg,LPSTR szKeyID)
+{
+ return p_pgp_select_keyid(hDlg,szKeyID);
+}
+
diff --git a/plugins/CryptoPP/src/cpp_rsam.cpp b/plugins/CryptoPP/src/cpp_rsam.cpp new file mode 100644 index 0000000000..3cdb391660 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_rsam.cpp @@ -0,0 +1,1074 @@ +#include "commonheaders.h"
+
+///////////////////////////////////////////////////////////////////////////
+
+#define RAND_SIZE (256/8)
+
+RSA_EXPORT exports = {
+ rsa_gen_keypair,
+ rsa_get_keypair,
+ rsa_get_keyhash,
+ rsa_set_keypair,
+ rsa_get_pubkey,
+ rsa_set_pubkey,
+ rsa_set_timeout,
+ rsa_get_state,
+ rsa_get_hash,
+ rsa_connect,
+ rsa_disconnect,
+ rsa_disabled,
+ rsa_recv,
+ rsa_send,
+ rsa_encrypt_file,
+ rsa_decrypt_file,
+ utf8encode,
+ utf8decode,
+ is_7bit_string,
+ is_utf8_string,
+ rsa_export_keypair,
+ rsa_import_keypair,
+ rsa_export_pubkey,
+ rsa_import_pubkey
+};
+
+pRSA_IMPORT imp;
+
+string null;
+int timeout = 10;
+
+const string priv_beg = "-----BEGIN SECUREIM PRIVATE KEY BLOCK-----";
+const string priv_end = "-----END SECUREIM PRIVATE KEY BLOCK-----";
+
+const string pub_beg = "-----BEGIN SECUREIM PUBLIC KEY BLOCK-----";
+const string pub_end = "-----END SECUREIM PUBLIC KEY BLOCK-----";
+
+const string crlf = "\x0D\x0A";
+
+///////////////////////////////////////////////////////////////////////////
+
+
+int __cdecl rsa_init(pRSA_EXPORT* e, pRSA_IMPORT i) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_init");
+#endif
+ *e = &exports;
+ imp = i;
+ if ( !hRSA4096 ) {
+ // create context for private rsa keys
+ hRSA4096 = (HANDLE) cpp_create_context(MODE_RSA_4096|MODE_PRIV_KEY);
+ pCNTX tmp = (pCNTX) hRSA4096;
+ pRSAPRIV p = new RSAPRIV;
+ tmp->pdata = (PBYTE) p;
+ }
+ return 1;
+}
+
+
+int __cdecl rsa_done(void) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_done");
+#endif
+ return 1;
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+
+
+pRSAPRIV rsa_gen_keys(HANDLE context) {
+
+ if ( context!=hRSA4096 ) return 0;
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_gen_keys: %d", context);
+#endif
+ pCNTX ptr = get_context_on_id(context);
+ pRSAPRIV r = (pRSAPRIV) ptr->pdata;
+
+ string priv, pub;
+ GenerateRSAKey(4096, priv, pub);
+
+ StringSource privsrc(priv, true, NULL);
+ RSAES_PKCS1v15_Decryptor Decryptor(privsrc);
+
+ priv = tlv(1, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModulus() )) +
+ tlv(2, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPublicExponent() )) +
+ tlv(3, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPrivateExponent() )) +
+ tlv(4, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPrime1() )) +
+ tlv(5, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPrime2() )) +
+ tlv(6, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModPrime1PrivateExponent() )) +
+ tlv(7, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModPrime2PrivateExponent() )) +
+ tlv(8, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetMultiplicativeInverseOfPrime2ModPrime1() ));
+
+ init_priv(r,priv);
+
+ return r;
+}
+
+
+pRSAPRIV rsa_get_priv(pCNTX ptr) {
+ pCNTX p = get_context_on_id(hRSA4096);
+ pRSAPRIV r = (pRSAPRIV) p->pdata;
+ return r;
+}
+
+
+int __cdecl rsa_gen_keypair(short mode) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_gen_keypair: %d", mode);
+#endif
+ if ( mode&MODE_RSA_4096 ) rsa_gen_keys(hRSA4096); // 4096
+
+ return 1;
+}
+
+
+int __cdecl rsa_get_keypair(short mode, PBYTE privKey, int* privKeyLen, PBYTE pubKey, int* pubKeyLen) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_get_keypair: %d", mode);
+#endif
+ pCNTX ptr = get_context_on_id(hRSA4096);
+ pRSAPRIV r = (pRSAPRIV) ptr->pdata;
+
+ *privKeyLen = r->priv_k.length(); if ( privKey ) r->priv_k.copy((char*)privKey, *privKeyLen);
+ *pubKeyLen = r->pub_k.length(); if ( pubKey ) r->pub_k.copy((char*)pubKey, *pubKeyLen);
+
+ return 1;
+}
+
+
+int __cdecl rsa_get_keyhash(short mode, PBYTE privKey, int* privKeyLen, PBYTE pubKey, int* pubKeyLen) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_get_keyhash: %d", mode);
+#endif
+ pCNTX ptr = get_context_on_id(hRSA4096);
+ pRSAPRIV r = (pRSAPRIV) ptr->pdata;
+
+ if ( privKey ) { *privKeyLen = r->priv_s.length(); r->priv_s.copy((char*)privKey, *privKeyLen); }
+ if ( pubKey ) { *pubKeyLen = r->pub_s.length(); r->pub_s.copy((char*)pubKey, *pubKeyLen); }
+
+ return 1;
+}
+
+
+int __cdecl rsa_set_keypair(short mode, PBYTE privKey, int privKeyLen) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_set_keypair: %s", privKey);
+#endif
+ pCNTX ptr = get_context_on_id(hRSA4096);
+ pRSAPRIV r = (pRSAPRIV) ptr->pdata;
+
+ if ( privKey && privKeyLen ) {
+ string priv;
+ priv.assign((char*)privKey, privKeyLen);
+
+ if ( mode & MODE_RSA_BER ) {
+ // old BER format
+ StringStore s(priv);
+ r->priv.BERDecode(s);
+
+ RSAES_PKCS1v15_Decryptor Decryptor(r->priv);
+
+ priv = tlv(1, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModulus() )) +
+ tlv(2, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPublicExponent() )) +
+ tlv(3, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPrivateExponent() )) +
+ tlv(4, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPrime1() )) +
+ tlv(5, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetPrime2() )) +
+ tlv(6, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModPrime1PrivateExponent() )) +
+ tlv(7, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetModPrime2PrivateExponent() )) +
+ tlv(8, IntegerToBinary(Decryptor.GetTrapdoorFunction().GetMultiplicativeInverseOfPrime2ModPrime1() ));
+
+ }
+ init_priv(r,priv);
+ }
+
+ return 1;
+}
+
+
+int __cdecl rsa_get_pubkey(HANDLE context, PBYTE pubKey, int* pubKeyLen) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_get_pubkey: %s", pubKey);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+
+ *pubKeyLen = p->pub_k.length(); if ( pubKey ) p->pub_k.copy((char*)pubKey, *pubKeyLen);
+
+ return 1;
+}
+
+
+int __cdecl rsa_set_pubkey(HANDLE context, PBYTE pubKey, int pubKeyLen) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_set_pubkey: %s", pubKey);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+
+ if ( pubKey && pubKeyLen ) {
+ string pub;
+ pub.assign((char*)pubKey, pubKeyLen);
+ init_pub(p,pub);
+ }
+
+ return 1;
+}
+
+
+void __cdecl rsa_set_timeout(int t) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_set_timeout: %d", t);
+#endif
+ timeout = t;
+}
+
+
+int __cdecl rsa_get_state(HANDLE context) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+
+ return p->state;
+}
+
+
+int __cdecl rsa_get_hash(PBYTE pubKey, int pubKeyLen, PBYTE pubHash, int* pubHashLen) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_get_hash: %d", pubKeyLen);
+#endif
+ string sig;
+ sig = ::hash(pubKey, pubKeyLen);
+
+ *pubHashLen = sig.length();
+ if ( pubHash ) sig.copy((char*)pubHash, *pubHashLen);
+
+ return 1;
+}
+
+
+int __cdecl rsa_connect(HANDLE context) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_connect: %08x", context);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr); if (p->state) return p->state;
+ pRSAPRIV r = rsa_get_priv(ptr);
+
+ if (ptr->mode&MODE_RSA_ONLY) {
+ inject_msg(context,0x0D,tlv(0,0)+tlv(1,r->pub_k)+tlv(2,p->pub_s));
+ p->state = 0x0D;
+ }
+ else {
+ inject_msg(context,0x10,tlv(0,0)+tlv(1,r->pub_s)+tlv(2,p->pub_s));
+ p->state = 2;
+ }
+ p->time = gettime()+timeout;
+
+ return p->state;
+}
+
+
+int __cdecl rsa_disconnect(HANDLE context) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_disconnect: %08x", context);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ rsa_free( ptr ); // удалим трэд и очередь сообщений
+
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+ if ( !p->state ) return 1;
+
+ PBYTE buffer=(PBYTE) alloca(RAND_SIZE);
+ GlobalRNG().GenerateBlock(buffer,RAND_SIZE);
+ inject_msg(context,0xF0,encode_msg(0,p,::hash(buffer,RAND_SIZE)));
+
+ p->state = 0;
+ imp->rsa_notify(context,-3); // соединение разорвано вручную
+
+ return 1;
+}
+
+
+int __cdecl rsa_disabled(HANDLE context) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_disabled: %08x", context);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ rsa_free( ptr ); // удалим трэд и очередь сообщений
+
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+ p->state = 0;
+ inject_msg(context,0xFF,null);
+// imp->rsa_notify(-context,-8); // соединение разорвано по причине "disabled"
+ return 1;
+}
+
+
+LPSTR __cdecl rsa_recv(HANDLE context, LPCSTR msg) {
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_recv: %s", msg);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+ pRSAPRIV r = rsa_get_priv(ptr);
+
+ rtrim(msg);
+
+ string buf = base64decode(msg);
+ if ( !buf.length() ) return 0;
+
+ string data; int type;
+ un_tlv(buf,type,data);
+ if ( type==-1 ) return 0;
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_recv: %02x %d", type, p->state);
+#endif
+ if ( type>0x10 && type<0xE0 ) // проверим тип сообщения (когда соединение еще не установлено)
+ if ( p->state==0 || p->state!=(type>>4) ) { // неверное состояние
+ // шлем перерывание сессии
+ p->state=0; p->time=0;
+ rsa_free( ptr ); // удалим трэд и очередь сообщений
+ null_msg(context,0x00,-1); // сессия разорвана по ошибке, неверный тип сообщения
+ return 0;
+ }
+
+ switch( type ) {
+
+ case 0x00: // прерывание сессии по ошибке другой стороной
+ {
+ // если соединение установлено - ничего не делаем
+ if ( p->state == 0 || p->state == 7 ) return 0;
+ // иначе сбрасываем текущее состояние
+ p->state=0; p->time=0;
+ imp->rsa_notify(context,-2); // сессия разорвана по ошибке другой стороной
+ } break;
+
+ // это все будем обрабатывать в отдельном потоке, чтобы избежать таймаутов
+ case 0x10: // запрос на установку соединения
+ case 0x22: // получили удаленный паблик, отправляем уже криптоключ
+ case 0x23: // отправляем локальный паблик
+ case 0x24: // получили удаленный паблик, отправим локальный паблик
+ case 0x33: // получили удаленный паблик, отправляем криптоключ
+ case 0x34:
+ case 0x21: // получили криптоключ, отправляем криптотест
+ case 0x32:
+ case 0x40:
+ case 0x0D: // запрос паблика
+ case 0xD0: // ответ пабликом
+ {
+ if ( !p->event ) {
+ p->event = CreateEvent(NULL,FALSE,FALSE,NULL);
+ unsigned int tID;
+ p->thread = (HANDLE) _beginthreadex(NULL, 0, sttConnectThread, (PVOID)context, 0, &tID);
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_recv: _beginthreadex(sttConnectThread)");
+#endif
+ }
+ EnterCriticalSection(&localQueueMutex);
+ p->queue->push(tlv(type,data));
+ LeaveCriticalSection(&localQueueMutex);
+ SetEvent(p->event); // сказали обрабатывать :)
+ } break;
+
+ case 0x50: // получили криптотест, отправляем свой криптотест
+ {
+ string msg = decode_msg(p,data);
+ if ( !msg.length() ) {
+ p->state=0; p->time=0;
+ null_msg(context,0x00,-type); // сессия разорвана по ошибке
+ return 0;
+ }
+ PBYTE buffer=(PBYTE) alloca(RAND_SIZE);
+ GlobalRNG().GenerateBlock(buffer,RAND_SIZE);
+ inject_msg(context,0x60,encode_msg(0,p,::hash(buffer,RAND_SIZE)));
+ p->state=7; p->time=0;
+ rsa_free_thread( p ); // удалим трэд и очередь сообщений
+ imp->rsa_notify(context,1); // заебися, криптосессия установлена
+ } break;
+
+ case 0x60: // получили криптотест, сессия установлена
+ {
+ string msg = decode_msg(p,data);
+ if ( !msg.length() ) {
+ p->state=0; p->time=0;
+ null_msg(context,0x00,-type); // сессия разорвана по ошибке
+ return 0;
+ }
+ p->state=7; p->time=0;
+ rsa_free_thread( p ); // удалим трэд и очередь сообщений
+ imp->rsa_notify(context,1); // заебися, криптосессия установлена
+ } break;
+
+ case 0x70: // получили AES сообщение, декодируем
+ {
+ SAFE_FREE(ptr->tmp);
+ string msg = decode_msg(p,data);
+ if ( msg.length() ) {
+ ptr->tmp = (LPSTR) _strdup(msg.c_str());
+ }
+ else {
+ imp->rsa_notify(context,-5); // ошибка декодирования AES сообщения
+ }
+ return ptr->tmp;
+ } break;
+
+ case 0xE0: // получили RSA сообщение, декодируем
+ {
+ SAFE_FREE(ptr->tmp);
+ string msg = decode_rsa(p,r,data);
+ if ( msg.length() ) {
+ ptr->tmp = (LPSTR) _strdup(msg.c_str());
+ }
+ else {
+ imp->rsa_notify(context,-6); // ошибка декодирования RSA сообщения
+ }
+ return ptr->tmp;
+ } break;
+
+ case 0xF0: // разрыв соединения вручную
+ {
+ if ( p->state != 7 ) return 0;
+ string msg = decode_msg(p,data);
+ if ( !msg.length() ) return 0;
+ p->state=0;
+ rsa_free( ptr ); // удалим трэд и очередь сообщений
+ imp->rsa_notify(context,-4); // соединение разорвано вручную другой стороной
+ } break;
+
+ case 0xFF: // разрыв соединения по причине "disabled"
+ {
+ p->state=0;
+ rsa_free( ptr ); // удалим трэд и очередь сообщений
+ imp->rsa_notify(context,-8); // соединение разорвано по причине "disabled"
+ } break;
+
+ }
+
+ if ( p->state != 0 && p->state != 7 )
+ p->time = gettime() + timeout;
+
+ return 0;
+}
+
+int __cdecl rsa_send(HANDLE context, LPCSTR msg) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr); if (p->state!=0 && p->state!=7) return 0;
+
+ if ( p->state == 7 ) // сессия установлена, шифруем AES и отправляем
+ inject_msg(context,0x70,encode_msg(1,p,string(msg)));
+ else
+ if ( p->state == 0 ) { // сессия установлена, отправляем RSA сообщение
+ if ( !p->pub_k.length() ) return 0;
+ // есть паблик ключ - отправим сообщение
+ pRSAPRIV r = rsa_get_priv(ptr);
+ inject_msg(context,0xE0,encode_rsa(1,p,r,string(msg)));
+ }
+
+ return 1;
+}
+
+
+void inject_msg(HANDLE context, int type, const string& msg) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("inject_msg(%02x): %s", type, msg.c_str());
+#endif
+ string txt=base64encode(tlv(type,msg));
+ imp->rsa_inject(context,(LPCSTR)txt.c_str());
+}
+
+
+string encode_msg(short z, pRSADATA p, string& msg) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("encode_msg: %s", msg.c_str());
+#endif
+ string zlib = (z) ? cpp_zlibc(msg) : msg;
+ string sig = ::hash(zlib);
+
+ string ciphered;
+ try {
+ CBC_Mode<AES>::Encryption enc((PBYTE)p->aes_k.data(),p->aes_k.length(),(PBYTE)p->aes_v.data());
+ StreamTransformationFilter cbcEncryptor(enc,new StringSink(ciphered));
+ cbcEncryptor.Put((PBYTE)zlib.data(),zlib.length());
+ cbcEncryptor.MessageEnd();
+ }
+ catch (...) {
+ ;
+ }
+ return tlv(z,ciphered)+tlv(2,sig);
+}
+
+
+string decode_msg(pRSADATA p, string& msg) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("decode_msg: %s", msg.c_str());
+#endif
+ string ciphered,sig; int t1,t2;
+ un_tlv(msg,t1,ciphered);
+ un_tlv(msg,t2,sig);
+
+ string unciphered,zlib;
+ try {
+ CBC_Mode<AES>::Decryption dec((PBYTE)p->aes_k.data(),p->aes_k.length(),(PBYTE)p->aes_v.data());
+ StreamTransformationFilter cbcDecryptor(dec,new StringSink(zlib));
+ cbcDecryptor.Put((PBYTE)ciphered.data(),ciphered.length());
+ cbcDecryptor.MessageEnd();
+
+ if ( sig == ::hash(zlib) ) {
+ unciphered = (t1==1) ? cpp_zlibd(zlib) : zlib;
+ }
+ }
+ catch (...) {
+ ;
+ }
+ return unciphered;
+}
+
+
+string encode_rsa(short z, pRSADATA p, pRSAPRIV r, string& msg) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("encode_rsa: %s", msg.c_str());
+#endif
+ string zlib = (z) ? cpp_zlibc(msg) : msg;
+
+ string enc = RSAEncryptString(p->pub,zlib);
+ string sig = RSASignString(r->priv,zlib);
+
+ return tlv(z,enc)+tlv(2,sig);
+}
+
+
+string decode_rsa(pRSADATA p, pRSAPRIV r, string& msg) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("decode_rsa: %s", msg.c_str());
+#endif
+ string ciphered,sig; int t1,t2;
+ un_tlv(msg,t1,ciphered);
+ un_tlv(msg,t2,sig);
+
+ string unciphered,zlib;
+ zlib = RSADecryptString(r->priv,ciphered);
+ if ( zlib.length() && RSAVerifyString(p->pub,zlib,sig) ) {
+ unciphered = (t1==1) ? cpp_zlibd(zlib) : zlib;
+ }
+ return unciphered;
+}
+
+
+string gen_aes_key_iv(short m, pRSADATA p, pRSAPRIV r) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("gen_aes_key_iv: %04x", m);
+#endif
+ PBYTE buffer=(PBYTE) alloca(RAND_SIZE);
+
+ GlobalRNG().GenerateBlock(buffer, RAND_SIZE);
+ p->aes_k = hash256(buffer,RAND_SIZE);
+
+ GlobalRNG().GenerateBlock(buffer, RAND_SIZE);
+ p->aes_v = hash256(buffer,RAND_SIZE);
+
+ string buf = tlv(10,p->aes_k)+tlv(11,p->aes_v);
+
+ return encode_rsa(0,p,r,buf);
+}
+
+
+void init_priv(pRSAPRIV r, string& priv) {
+
+ r->priv_k = priv;
+ r->priv_s = ::hash(priv);
+
+ int t;
+ string tmp, n, e, d, p, q, dp, dq, u;
+
+ while( priv.length() ) {
+ un_tlv(priv,t,tmp);
+ switch(t) {
+ case 1: n = tmp; break;
+ case 2: e = tmp; break;
+ case 3: d = tmp; break;
+ case 4: p = tmp; break;
+ case 5: q = tmp; break;
+ case 6: dp = tmp; break;
+ case 7: dq = tmp; break;
+ case 8: u = tmp; break;
+ }
+ }
+
+ // if ( !empty );
+
+ r->pub_k = tlv(1,n)+tlv(2,e);
+ r->pub_s = ::hash(r->pub_k);
+
+ r->priv.Initialize(BinaryToInteger(n),BinaryToInteger(e),
+ BinaryToInteger(d),BinaryToInteger(p),BinaryToInteger(q),
+ BinaryToInteger(dp),BinaryToInteger(dq),BinaryToInteger(u));
+}
+
+
+void init_pub(pRSADATA p, string& pub) {
+
+ p->pub_k = pub;
+ p->pub_s = ::hash(pub);
+
+ int t;
+ string tmp, n, e;
+
+ while( pub.length() ) {
+ un_tlv(pub,t,tmp);
+ switch(t) {
+ case 1: n = tmp; break;
+ case 2: e = tmp; break;
+ }
+ }
+
+ // if ( !empty );
+
+ p->pub.Initialize(BinaryToInteger(n),BinaryToInteger(e));
+}
+
+
+void null_msg(HANDLE context, int type, int status) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("null_msg: %02x", status);
+#endif
+ inject_msg(context,type,null);
+ imp->rsa_notify(context,status);
+}
+
+
+void rsa_timeout(HANDLE context, pRSADATA p) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_timeout");
+#endif
+ p->state=0; p->time=0;
+// null_msg(context,0x00,-7);
+ imp->rsa_notify(context,-7); // сессия разорвана по таймауту
+}
+
+
+int __cdecl rsa_encrypt_file(HANDLE context,LPCSTR file_in,LPCSTR file_out) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr); if (p->state!=7) return 0;
+
+ try {
+ CBC_Mode<AES>::Encryption enc((PBYTE)p->aes_k.data(),p->aes_k.length(),(PBYTE)p->aes_v.data());
+ FileSource *f = new FileSource(file_in,true,new StreamTransformationFilter (enc,new FileSink(file_out)));
+ delete f;
+ }
+ catch (...) {
+ return 0;
+ }
+ return 1;
+}
+
+
+int __cdecl rsa_decrypt_file(HANDLE context,LPCSTR file_in,LPCSTR file_out) {
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr); if (p->state!=7) return 0;
+
+ try {
+ CBC_Mode<AES>::Decryption dec((PBYTE)p->aes_k.data(),p->aes_k.length(),(PBYTE)p->aes_v.data());
+ FileSource *f = new FileSource(file_in,true,new StreamTransformationFilter (dec,new FileSink(file_out)));
+ delete f;
+ }
+ catch (...) {
+ return 0;
+ }
+ return 1;
+}
+
+
+int __cdecl rsa_recv_thread(HANDLE context, string& msg) {
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_recv_thread: %s", msg.c_str());
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+ pRSAPRIV r = rsa_get_priv(ptr);
+
+ string data; int type;
+ un_tlv(msg,type,data);
+ if ( type==-1 ) return 0;
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_recv_thread: %02x %d", type, p->state);
+#endif
+ int t[4];
+
+ switch( type ) {
+
+ case 0x10:
+ {
+ int features; string sha1,sha2;
+ un_tlv(un_tlv(un_tlv(data,t[0],features),t[1],sha1),t[2],sha2);
+ BOOL lr = (p->pub_s==sha1); BOOL ll = (r->pub_s==sha2);
+ switch( (lr<<4)|ll ) {
+ case 0x11: { // оба паблика совпали
+ inject_msg(context,0x21,gen_aes_key_iv(ptr->mode,p,r));
+ p->state=5;
+ } break;
+ case 0x10: { // совпал удаленный паблик, нужен локальный
+ inject_msg(context,0x22,tlv(0,features)+tlv(1,r->pub_k)+tlv(2,r->pub_s));
+ p->state=3;
+ } break;
+ case 0x01: { // совпал локальный паблик, нужен удаленный
+ inject_msg(context,0x23,tlv(0,features));
+ p->state=3;
+ } break;
+ case 0x00: { // не совпали оба паблика
+ inject_msg(context,0x24,tlv(0,features)+tlv(1,r->pub_k)+tlv(2,r->pub_s));
+ p->state=3;
+ } break;
+ }
+ } break;
+
+ case 0x22: // получили удаленный паблик, отправляем уже криптоключ
+ {
+ int features; string pub;
+ un_tlv(un_tlv(data,t[0],features),t[1],pub);
+ string sig = ::hash(pub);
+ if ( !imp->rsa_check_pub(context,(PBYTE)pub.data(),pub.length(),(PBYTE)sig.data(),sig.length()) ) {
+ p->state=0; p->time=0;
+ null_msg(context,0x00,-type); // сессия разорвана по ошибке
+ return 0;
+ }
+ init_pub(p,pub);
+ if ( p->state==0 ) { // timeout
+// rsa_connect(context);
+ return -1;
+ }
+ inject_msg(context,0x32,gen_aes_key_iv(ptr->mode,p,r));
+ p->state=5;
+ } break;
+
+ case 0x23: // отправляем локальный паблик
+ {
+ int features;
+ un_tlv(data,t[0],features);
+ inject_msg(context,0x33,tlv(1,r->pub_k)+tlv(2,r->pub_s));
+ p->state=4;
+ } break;
+
+ case 0x24: // получили удаленный паблик, отправим локальный паблик
+ {
+ int features; string pub;
+ un_tlv(un_tlv(data,t[0],features),t[1],pub);
+ string sig = ::hash(pub);
+ if ( !imp->rsa_check_pub(context,(PBYTE)pub.data(),pub.length(),(PBYTE)sig.data(),sig.length()) ) {
+ p->state=0; p->time=0;
+ null_msg(context,0x00,-type); // сессия разорвана по ошибке
+ return 0;
+ }
+ init_pub(p,pub);
+ if ( p->state==0 ) { // timeout
+// rsa_connect(context);
+ return -1;
+ }
+ inject_msg(context,0x34,tlv(1,r->pub_k)+tlv(2,r->pub_s));
+ p->state=4;
+ } break;
+
+ case 0x33: // получили удаленный паблик, отправляем криптоключ
+ case 0x34:
+ {
+ string pub;
+ un_tlv(data,t[0],pub);
+ string sig = ::hash(pub);
+ if ( !imp->rsa_check_pub(context,(PBYTE)pub.data(),pub.length(),(PBYTE)sig.data(),sig.length()) ) {
+ p->state=0; p->time=0;
+ null_msg(context,0x00,-type); // сессия разорвана по ошибке
+ return 0;
+ }
+ init_pub(p,pub);
+ if ( p->state==0 ) { // timeout
+// rsa_connect(context);
+ return -1;
+ }
+ inject_msg(context,0x40,gen_aes_key_iv(ptr->mode,p,r));
+ p->state=5;
+ } break;
+
+ case 0x21: // получили криптоключ, отправляем криптотест
+ case 0x32:
+ case 0x40:
+ {
+ string key = decode_rsa(p,r,data);
+ if ( !key.length() ) {
+ p->state=0; p->time=0;
+ null_msg(context,0x00,-type); // сессия разорвана по ошибке
+ return 0;
+ }
+ un_tlv(key,t[0],p->aes_k);
+ un_tlv(key,t[1],p->aes_v);
+ PBYTE buffer=(PBYTE) alloca(RAND_SIZE);
+ GlobalRNG().GenerateBlock(buffer,RAND_SIZE);
+ inject_msg(context,0x50,encode_msg(0, p, ::hash(buffer,RAND_SIZE)));
+ p->state=6;
+ } break;
+
+ case 0x0D: // запрос паблика
+ case 0xD0: // ответ пабликом
+ {
+ int features; string pub,sha;
+ un_tlv(un_tlv(un_tlv(data,t[0],features),t[1],pub),t[2],sha);
+ if ( p->pub_k!=pub ) { // пришел новый паблик
+ string sig = ::hash(pub);
+ if ( !imp->rsa_check_pub(context,(PBYTE)pub.data(),pub.length(),(PBYTE)sig.data(),sig.length()) ) {
+ p->state=0; p->time=0;
+ null_msg(context,0x00,-type); // сессия разорвана по ошибке
+ return 0;
+ }
+ init_pub(p,pub);
+ }
+ if ( type == 0x0D ) { // нужно отправить мой паблик
+ inject_msg(context,0xD0,tlv(0,features)+tlv(1,r->pub_k)+tlv(2,p->pub_s));
+ }
+ p->state=0; p->time=0;
+ } break;
+
+ }
+
+ if ( p->state != 0 && p->state != 7 )
+ p->time = gettime() + timeout;
+
+ return 1;
+}
+
+
+void rsa_alloc( pCNTX ptr ) {
+ pRSADATA p = new RSADATA;
+ p->state = 0;
+ p->time = 0;
+ p->thread = p->event = NULL;
+ p->thread_exit = 0;
+ p->queue = new STRINGQUEUE;
+ ptr->pdata = (PBYTE) p;
+}
+
+
+void rsa_free( pCNTX ptr ) {
+ pRSADATA p = (pRSADATA) ptr->pdata;
+ if ( p && p->event ) {
+ p->thread_exit = 2; // отпускаем поток в свободное плавание
+ SetEvent( p->event );
+ rsa_alloc(ptr);
+ }
+}
+
+
+void rsa_free_thread( pRSADATA p ) {
+ if ( p->event ) {
+ p->thread_exit = 1;
+ SetEvent( p->event );
+ // ждем завершения потока
+ WaitForSingleObject(p->thread, INFINITE);
+ CloseHandle( p->thread );
+ CloseHandle( p->event );
+ p->thread = p->event = NULL;
+ p->thread_exit = 0;
+ }
+ p->time = 0;
+ clear_queue( p );
+}
+
+
+void clear_queue( pRSADATA p ) {
+ EnterCriticalSection(&localQueueMutex);
+ while( p->queue && !p->queue->empty() ) {
+ p->queue->pop();
+ }
+ LeaveCriticalSection(&localQueueMutex);
+}
+
+
+// establish RSA/AES thread
+unsigned __stdcall sttConnectThread( LPVOID arg ) {
+
+ HANDLE context = (HANDLE) arg;
+
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+
+ while(1) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("sttConnectThread: WaitForSingleObject");
+#endif
+ WaitForSingleObject(p->event, INFINITE); // dwMsec rc==WAIT_TIMEOUT
+ if ( p->thread_exit == 1 ) return 0;
+ if ( p->thread_exit == 2 ) {
+ // мы в свободном плавании - освободим память и завершим трэд
+ CloseHandle( p->thread );
+ CloseHandle( p->event );
+ SAFE_DELETE(p->queue);
+ SAFE_DELETE(p);
+ return 0;
+ }
+ // дождались сообщения в очереди
+ while( !p->thread_exit && p->queue && !p->queue->empty() ) {
+ // обработаем сообщения из очереди
+ if ( rsa_recv_thread(context, p->queue->front()) == -1 ) {
+ // очистить очередь
+ clear_queue(p);
+ break;
+ }
+ EnterCriticalSection(&localQueueMutex);
+ p->queue->pop();
+ LeaveCriticalSection(&localQueueMutex);
+ }
+ }
+}
+
+
+int __cdecl rsa_export_keypair(short mode, LPSTR privKey, LPSTR pubKey, LPSTR passPhrase) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_export_keypair: %d", mode);
+#endif
+ pCNTX ptr = get_context_on_id(hRSA4096);
+ pRSAPRIV r = (pRSAPRIV) ptr->pdata;
+
+ if ( pubKey ) {
+ string pub;
+ pub = tlv(3,r->pub_k) + tlv(4,r->pub_s);
+ pub = pub_beg + crlf + add_delim(base64encode(pub),crlf,65) + pub_end + crlf;
+ strcpy(pubKey, pub.c_str());
+ }
+
+ if ( privKey && passPhrase ) {
+ string key = hash256(passPhrase);
+ string iv = hash256(key);
+ string priv = pad256(r->priv_k);
+
+ string ciphered;
+ try {
+ CBC_Mode<AES>::Encryption enc((PBYTE)key.data(),key.length(),(PBYTE)iv.data());
+ StreamTransformationFilter cbcEncryptor(enc,new StringSink(ciphered));
+ cbcEncryptor.Put((PBYTE)priv.data(),priv.length());
+ cbcEncryptor.MessageEnd();
+ }
+ catch (...) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_export_keypair: error bad_passphrase");
+#endif
+ return 0;
+ }
+
+ priv = tlv(1,ciphered) + tlv(2,::hash(ciphered));
+ priv = priv_beg + crlf + add_delim(base64encode(priv),crlf,65) + priv_end + crlf;
+
+ strcpy(privKey, priv.c_str());
+ }
+
+ return 1;
+}
+
+
+int __cdecl rsa_import_keypair(short mode, LPSTR privKey, LPSTR passPhrase) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_import_keypair: %d", mode);
+#endif
+ pCNTX ptr = get_context_on_id(hRSA4096);
+ pRSAPRIV r = (pRSAPRIV) ptr->pdata;
+
+ if ( !passPhrase ) return 0;
+
+ string priv;
+ u_int found;
+
+ priv.assign(privKey);
+ del_delim(priv,crlf);
+
+ found = priv.find(priv_beg);
+ if ( found != string::npos ) {
+ priv = priv.substr(found+priv_beg.length());
+ found = priv.find(priv_end);
+ if ( found != string::npos ) {
+ priv = base64decode(priv.substr(0,found));
+ TLV k(priv);
+ if ( k.exist(1) && k.exist(2) && ::hash(k.get(1)) == k.get(2) ) {
+ priv = k.get(1);
+
+ string key = hash256(passPhrase);
+ string iv = hash256(key);
+
+ string unciphered;
+ try {
+ CBC_Mode<AES>::Decryption dec((PBYTE)key.data(),key.length(),(PBYTE)iv.data());
+ StreamTransformationFilter cbcDecryptor(dec,new StringSink(unciphered));
+ cbcDecryptor.Put((PBYTE)priv.data(),priv.length());
+ cbcDecryptor.MessageEnd();
+ }
+ catch (...) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_import_keypair: error bad_passphrase");
+#endif
+ return 0;
+ }
+
+ init_priv(r,unciphered);
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+int __cdecl rsa_export_pubkey(HANDLE context, LPSTR pubKey) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_export_pubkey: %08x", context);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+
+ if ( !p->pub_k.length() || !pubKey ) return 0;
+
+ string pub;
+ pub = tlv(3,p->pub_k) + tlv(4,p->pub_s);
+ pub = pub_beg + crlf + add_delim(base64encode(pub),crlf,65) + pub_end + crlf;
+ strcpy(pubKey, pub.c_str());
+
+ return 1;
+}
+
+
+int __cdecl rsa_import_pubkey(HANDLE context, LPSTR pubKey) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("rsa_import_pubkey: %08x", context);
+#endif
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
+ pRSADATA p = (pRSADATA) cpp_alloc_pdata(ptr);
+
+ if ( !pubKey ) return 0;
+
+ string pub;
+ u_int found;
+
+ pub.assign(pubKey);
+ del_delim(pub,crlf);
+
+ found = pub.find(pub_beg);
+ if ( found != string::npos ) {
+ pub = pub.substr(found+pub_beg.length());
+ found = pub.find(pub_end);
+ if ( found != string::npos ) {
+ pub = base64decode(pub.substr(0,found));
+ TLV k(pub);
+ if ( k.exist(3) && k.exist(4) && ::hash(k.get(3)) == k.get(4) ) {
+ init_pub(p,k.get(3));
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/cpp_rsam.h b/plugins/CryptoPP/src/cpp_rsam.h new file mode 100644 index 0000000000..92c1143212 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_rsam.h @@ -0,0 +1,45 @@ +#ifndef __CPP_RSAM_H__
+#define __CPP_RSAM_H__
+
+int __cdecl rsa_gen_keypair(short);
+int __cdecl rsa_get_keypair(short,PBYTE,int*,PBYTE,int*);
+int __cdecl rsa_get_keyhash(short,PBYTE,int*,PBYTE,int*);
+int __cdecl rsa_set_keypair(short,PBYTE,int);
+int __cdecl rsa_get_pubkey(HANDLE,PBYTE,int*);
+int __cdecl rsa_set_pubkey(HANDLE,PBYTE,int);
+void __cdecl rsa_set_timeout(int);
+int __cdecl rsa_get_state(HANDLE);
+int __cdecl rsa_get_hash(PBYTE,int,PBYTE,int*);
+int __cdecl rsa_connect(HANDLE);
+int __cdecl rsa_disconnect(HANDLE);
+int __cdecl rsa_disabled(HANDLE);
+LPSTR __cdecl rsa_recv(HANDLE,LPCSTR);
+int __cdecl rsa_send(HANDLE,LPCSTR);
+int __cdecl rsa_encrypt_file(HANDLE,LPCSTR,LPCSTR);
+int __cdecl rsa_decrypt_file(HANDLE,LPCSTR,LPCSTR);
+int __cdecl rsa_export_keypair(short,LPSTR,LPSTR,LPSTR);
+int __cdecl rsa_import_keypair(short,LPSTR,LPSTR);
+int __cdecl rsa_export_pubkey(HANDLE,LPSTR);
+int __cdecl rsa_import_pubkey(HANDLE,LPSTR);
+
+
+void inject_msg(HANDLE,int,const string&);
+string encode_msg(short,pRSADATA,string&);
+string decode_msg(pRSADATA,string&);
+string encode_rsa(short,pRSADATA,pRSAPRIV,string&);
+string decode_rsa(pRSADATA,pRSAPRIV,string&);
+string gen_aes_key_iv(short,pRSADATA,pRSAPRIV);
+void init_priv(pRSAPRIV,string&);
+void init_pub(pRSADATA,string&);
+void null_msg(HANDLE,int,int);
+
+void rsa_timeout(HANDLE,pRSADATA);
+void rsa_alloc(pCNTX);
+void rsa_free(pCNTX);
+void rsa_free_thread(pRSADATA);
+void clear_queue(pRSADATA);
+
+
+unsigned __stdcall sttConnectThread(LPVOID);
+
+#endif
diff --git a/plugins/CryptoPP/src/cpp_rsau.cpp b/plugins/CryptoPP/src/cpp_rsau.cpp new file mode 100644 index 0000000000..e9ad825dd0 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_rsau.cpp @@ -0,0 +1,258 @@ +#include "commonheaders.h"
+
+const string padding = "PADDING!PADDING!PADDING!PADDING!"; // 256 bit
+
+
+string pad256(string& str) {
+ string out = str;
+ int pad = out.length() % 32;
+ if ( pad ) { // ¤® ўла®ўпвм 256 ЎЁв
+ if ( pad>3 ) {
+ out += tlv(0,padding.substr(0,32-3-pad));
+ }
+ else {
+ if ( pad==3 ) out += string("\0\0\0");
+ else
+ if ( pad==2 ) out += string("\0\0");
+ else out += string("\0");
+ }
+ }
+ return out;
+}
+
+
+string& add_delim(string& str, const string& del, int len) {
+ string val;
+ for ( u_int i=0; i<str.length(); i+=len ) {
+ val += str.substr(i,len) + del;
+ }
+ str = val;
+ return str;
+}
+
+
+string& del_delim(string& str, const string& del) {
+ string val;
+ for ( u_int i=0; i<str.length(); i++ ) {
+ if ( del.find(str[i]) == string::npos )
+ val += str[i];
+ }
+ str = val;
+ return str;
+}
+
+
+string tlv(int t, const string& v) {
+ string b;
+ t |= v.length()<<8;
+ b.assign((const char*)&t,3);
+ b += v;
+ return b;
+}
+
+
+string tlv(int t, const char* v) {
+ return tlv(t, string(v));
+}
+
+
+string tlv(int t, int v) {
+ string s;
+ u_int l=(v<=0xFF)?1:((v<=0xFFFF)?2:((v<=0xFFFFFF)?3:4));
+ s.assign((char*)&v,l);
+ return tlv(t,s);
+}
+
+
+string& un_tlv(string& b, int& t, string& v) {
+ string r; v = r;
+ if ( b.length() > 3 ) {
+ t = 0;
+ b.copy((char*)&t,3);
+ u_int l = t>>8;
+ t &= 0xFF;
+ if ( b.length() >= 3+l ) {
+ v = b.substr(3,l);
+ r = b.substr(3+l);
+ }
+ }
+ if ( !v.length() ) {
+ t = -1;
+ }
+ b = r;
+ return b;
+}
+
+
+string& un_tlv(string& b, int& t, int& v) {
+ string s;
+ un_tlv(b,t,s);
+ v = 0;
+ s.copy((char*)&v,s.length());
+ return b;
+}
+
+
+int str2int(string& s) {
+ int v = 0;
+ if ( s.length()<=sizeof(int) )
+ s.copy((char*)&v,s.length());
+ return v;
+}
+
+
+string hash(string& b)
+{
+ return ::hash((PBYTE)b.data(),b.length());
+}
+
+
+string hash(PBYTE b, int l)
+{
+ BYTE h[RSA_KEYSIZE];
+ RSA_CalculateDigest(h, b, l);
+ string s; s.assign((char*)&h,RSA_KEYSIZE);
+ return s;
+}
+
+
+string hash128(string& b)
+{
+ return hash128((PBYTE)b.data(),b.length());
+}
+
+
+string hash128(LPSTR b)
+{
+ return hash128((PBYTE)b,strlen(b));
+}
+
+
+string hash128(PBYTE b, int l)
+{
+ BYTE h[RIPEMD128::DIGESTSIZE];
+ RIPEMD128().CalculateDigest(h, b, l);
+ string s; s.assign((char*)&h,sizeof(h));
+ return s;
+}
+
+
+string hash256(string& b)
+{
+ return hash256((PBYTE)b.data(),b.length());
+}
+
+
+string hash256(LPSTR b)
+{
+ return hash256((PBYTE)b,strlen(b));
+}
+
+
+string hash256(PBYTE b, int l)
+{
+// BYTE h[SHA256::DIGESTSIZE];
+// SHA256().CalculateDigest(h, b, l);
+ BYTE h[RIPEMD256::DIGESTSIZE];
+ RIPEMD256().CalculateDigest(h, b, l);
+ string s; s.assign((char*)&h,sizeof(h));
+ return s;
+}
+
+
+Integer BinaryToInteger(const string& data)
+{
+ StringSource ss(data, true, NULL);
+ SecByteBlock result(ss.MaxRetrievable());
+ ss.Get(result, result.size());
+ return Integer(result, result.size());
+}
+
+
+string IntegerToBinary(const Integer& value)
+{
+ SecByteBlock sbb(value.MinEncodedSize());
+ value.Encode(sbb, sbb.size());
+ string data;
+ StringSource(sbb, sbb.size(), true, new StringSink(data));
+ return data;
+}
+
+/*
+RandomPool& GlobalRNG()
+{
+ static RandomPool randomPool;
+ return randomPool;
+}
+*/
+
+AutoSeededRandomPool& GlobalRNG()
+{
+ static AutoSeededRandomPool randomPool;
+ return randomPool;
+}
+
+
+void GenerateRSAKey(unsigned int keyLength, string& privKey, string& pubKey)
+{
+ RSAES_PKCS1v15_Decryptor priv(GlobalRNG(), keyLength);
+ StringSink privFile(privKey);
+ priv.DEREncode(privFile);
+ privFile.MessageEnd();
+
+ RSAES_PKCS1v15_Encryptor pub(priv);
+ StringSink pubFile(pubKey);
+ pub.DEREncode(pubFile);
+ pubFile.MessageEnd();
+}
+
+
+string RSAEncryptString(const RSA::PublicKey& pubkey, const string& plaintext)
+{
+ RSAES_PKCS1v15_Encryptor pub(pubkey);
+
+ string result;
+ StringSource(plaintext, true, new PK_EncryptorFilter(GlobalRNG(), pub, new StringSink(result)));
+ return result;
+}
+
+
+string RSADecryptString(const RSA::PrivateKey& privkey, const string& ciphertext)
+{
+ RSAES_PKCS1v15_Decryptor priv(privkey);
+
+ string result;
+ try {
+ StringSource(ciphertext, true, new PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result)));
+ }
+ catch (...) {
+ ;
+ }
+ return result;
+}
+
+
+string RSASignString(const RSA::PrivateKey& privkey, const string& plaintext)
+{
+ RSASSA_PKCS1v15_SHA_Signer priv(privkey);
+
+ string result;
+ try {
+ StringSource(plaintext, true, new SignerFilter(GlobalRNG(), priv, new StringSink(result)));
+ }
+ catch (...) {
+ ;
+ }
+ return result;
+}
+
+
+BOOL RSAVerifyString(const RSA::PublicKey& pubkey, const string& plaintext, const string& sig)
+{
+ RSASSA_PKCS1v15_SHA_Verifier ver(pubkey);
+
+ return ver.VerifyMessage((PBYTE)plaintext.data(), plaintext.length(), (PBYTE)sig.data(), sig.length());
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/cpp_rsau.h b/plugins/CryptoPP/src/cpp_rsau.h new file mode 100644 index 0000000000..bc45a248c5 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_rsau.h @@ -0,0 +1,101 @@ +#ifndef __CPP_RSAU_H__
+#define __CPP_RSAU_H__
+
+class TLV {
+private:
+ map<u_char,string> data;
+
+public:
+ TLV();
+ TLV(const string& b) { decode(b); };
+
+ string encode() {
+ map<u_char,string>::const_iterator i;
+ string b;
+ for ( i=data.begin(); i!=data.end(); ++i ) {
+ b += tlv(i->first,i->second);
+ }
+ return b;
+ };
+ void decode(const string& b) {
+ u_char t;
+ string v;
+ string r = b;
+ while( r.length() ) {
+ t = un_tlv(r,v);
+ if ( t==-1 ) {
+ break;
+ }
+ data[t] = v;
+ }
+ };
+
+ size_t count() { return data.size(); };
+ bool exist(u_char t) { return (data.find(t) != data.end()); };
+ string get(u_char t) { return data[t]; };
+ void put(u_char t, string& v) { data[t]=v; };
+
+private:
+ string tlv(u_int t, const string& v) {
+ string b;
+ t |= v.length()<<8;
+ b.assign((const char*)&t,3);
+ b += v;
+ return b;
+ };
+ u_char un_tlv(string& b, string& v) {
+ string r; v = r;
+ u_int t = 0;
+ if ( b.length() > 3 ) {
+ b.copy((char*)&t,3);
+ u_int l = t>>8;
+ t &= 0xFF;
+ if ( b.length() >= 3+l ) {
+ v = b.substr(3,l);
+ r = b.substr(3+l);
+ }
+ }
+ if ( !v.length() ) {
+ return -1;
+ }
+ b = r;
+ return t;
+ };
+};
+
+string pad256(string&);
+
+string& add_delim(string&,const string&,int);
+string& del_delim(string&,const string&);
+
+string tlv(int,const string&);
+string tlv(int,const char*);
+string tlv(int,int);
+string& un_tlv(string&,int&,string&);
+string& un_tlv(string&,int&,int&);
+
+int str2int(string&);
+
+string hash(string&);
+string hash(PBYTE,int);
+
+string hash128(string&);
+string hash128(LPSTR);
+string hash128(PBYTE,int);
+
+string hash256(string&);
+string hash256(LPSTR);
+string hash256(PBYTE,int);
+
+Integer BinaryToInteger(const string&);
+string IntegerToBinary(const Integer&);
+
+AutoSeededRandomPool& GlobalRNG();
+
+void GenerateRSAKey(unsigned int,string&,string&);
+string RSAEncryptString(const RSA::PublicKey&,const string&);
+string RSADecryptString(const RSA::PrivateKey&,const string&);
+string RSASignString(const RSA::PrivateKey&,const string&);
+BOOL RSAVerifyString(const RSA::PublicKey&,const string&,const string&);
+
+#endif
diff --git a/plugins/CryptoPP/src/cpp_svcs.cpp b/plugins/CryptoPP/src/cpp_svcs.cpp new file mode 100644 index 0000000000..e2a1dd9053 --- /dev/null +++ b/plugins/CryptoPP/src/cpp_svcs.cpp @@ -0,0 +1,329 @@ +#include "commonheaders.h"
+
+const unsigned char IV[] = "SIMhell@MIRANDA!";
+
+
+// encrypt string using KeyX, return encoded string as ASCII or NULL
+LPSTR __cdecl cpp_encrypt(pCNTX ptr, LPCSTR szPlainMsg)
+{
+ ptr->error = ERROR_NONE;
+ pSIMDATA p = (pSIMDATA) ptr->pdata;
+
+ BYTE dataflag = 0;
+ size_t clen, slen = strlen(szPlainMsg);
+
+ LPSTR szMsg;
+ if (ptr->features & FEATURES_GZIP) {
+ szMsg = (LPSTR) cpp_gzip((BYTE*)szPlainMsg,slen,clen);
+ if (clen>=slen) {
+ free(szMsg);
+ szMsg = _strdup(szPlainMsg);
+ }
+ else {
+ slen = clen;
+ dataflag |= DATA_GZIP;
+ }
+ }
+ else szMsg = _strdup(szPlainMsg);
+
+ string ciphered;
+
+ CBC_Mode<AES>::Encryption enc(p->KeyX,Tiger::DIGESTSIZE,IV);
+ StreamTransformationFilter cbcEncryptor(enc,new StringSink(ciphered));
+
+ cbcEncryptor.Put((PBYTE)szMsg, slen);
+ cbcEncryptor.MessageEnd();
+
+ free(szMsg);
+
+ clen = (int) ciphered.length();
+ if (ptr->features & FEATURES_CRC32) {
+ BYTE crc32[CRC32::DIGESTSIZE];
+ memset(crc32,0,sizeof(crc32));
+ CRC32().CalculateDigest(crc32, (BYTE*)ciphered.data(), clen);
+ ciphered.insert(0,(LPSTR)&crc32,CRC32::DIGESTSIZE);
+ ciphered.insert(0,(LPSTR)&clen,2);
+ }
+ if (ptr->features & FEATURES_GZIP)
+ ciphered.insert(0,(LPSTR)&dataflag,1);
+
+ clen = (int) ciphered.length();
+
+ SAFE_FREE(ptr->tmp);
+ if (ptr->features & FEATURES_BASE64)
+ ptr->tmp = base64encode(ciphered.data(),clen);
+ else
+ ptr->tmp = base16encode(ciphered.data(),clen);
+
+ return ptr->tmp;
+}
+
+
+// decrypt string using KeyX, return decoded string as ASCII or NULL
+LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg)
+{
+ LPSTR ciphered = NULL;
+
+ try {
+ ptr->error = ERROR_SEH;
+ pSIMDATA p = (pSIMDATA) ptr->pdata;
+
+ size_t clen = strlen(szEncMsg);
+
+ if (ptr->features & FEATURES_BASE64)
+ ciphered = base64decode(szEncMsg,&clen);
+ else
+ ciphered = base16decode(szEncMsg,&clen);
+
+ LPSTR bciphered = ciphered;
+
+ BYTE dataflag=0;
+ if (ptr->features & FEATURES_GZIP) {
+ dataflag = *ciphered;
+ bciphered++; clen--; // cut GZIP flag
+ }
+ if (ptr->features & FEATURES_CRC32) {
+ int len = *( WORD* )bciphered;
+ bciphered+=2; clen-=2; // cut CRC32 length
+
+ if (clen-CRC32::DIGESTSIZE<len) { // mesage not full
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_decrypt: error bad_len");
+#endif
+ free(ciphered);
+ ptr->error = ERROR_BAD_LEN;
+ return NULL;
+ }
+
+ BYTE crc32[CRC32::DIGESTSIZE];
+ memset(crc32,0,sizeof(crc32));
+
+ CRC32().CalculateDigest(crc32, (PBYTE)(bciphered+CRC32::DIGESTSIZE), len);
+
+ if (memcmp(crc32,bciphered,CRC32::DIGESTSIZE)) { // message is bad crc
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_decrypt: error bad_crc");
+#endif
+ free(ciphered);
+ ptr->error = ERROR_BAD_CRC;
+ return NULL;
+ }
+ bciphered+=CRC32::DIGESTSIZE; // cut CRC32 digest
+ clen=len;
+ }
+
+ string unciphered;
+
+ CBC_Mode<AES>::Decryption dec(p->KeyX,Tiger::DIGESTSIZE,IV);
+ StreamTransformationFilter cbcDecryptor(dec,new StringSink(unciphered));
+
+ cbcDecryptor.Put((PBYTE)bciphered,clen);
+ cbcDecryptor.MessageEnd();
+
+ free(ciphered);
+ SAFE_FREE(ptr->tmp);
+
+ if (dataflag & DATA_GZIP) {
+ ptr->tmp = (LPSTR) cpp_gunzip((PBYTE)unciphered.data(),unciphered.length(),clen);
+ ptr->tmp[clen] = 0;
+ }
+ else ptr->tmp = (LPSTR) _strdup(unciphered.c_str());
+
+ ptr->error = ERROR_NONE;
+ return ptr->tmp;
+ }
+ catch (...) {
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ Sent_NetLog("cpp_decrypt: error seh");
+#endif
+ free(ciphered);
+ SAFE_FREE(ptr->tmp);
+ return NULL;
+ }
+}
+
+
+// encode message from ANSI into UTF8 if need
+LPSTR __cdecl cpp_encodeA(HANDLE context, LPCSTR msg)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return NULL;
+ cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA) ptr->pdata;
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+
+ LPSTR szNewMsg = NULL;
+ LPSTR szOldMsg = (LPSTR) msg;
+
+ if (ptr->features & FEATURES_UTF8) {
+ // ansi message: convert to unicode->utf-8 and encrypt.
+ int slen = strlen(szOldMsg)+1;
+ LPWSTR wstring = (LPWSTR) alloca(slen*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(WCHAR));
+ // encrypt
+ szNewMsg = cpp_encrypt(ptr, utf8encode(wstring));
+ }
+ else {
+ // ansi message: encrypt.
+ szNewMsg = cpp_encrypt(ptr, szOldMsg);
+ }
+
+ return szNewMsg;
+}
+
+
+// encode message from UTF8
+LPSTR __cdecl cpp_encodeU(HANDLE context, LPCSTR msg)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return NULL;
+ cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA) ptr->pdata;
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+
+ LPSTR szNewMsg = NULL;
+ LPSTR szOldMsg = (LPSTR) msg;
+
+ if (ptr->features & FEATURES_UTF8) {
+ // utf8 message: encrypt.
+ szNewMsg = cpp_encrypt(ptr, szOldMsg);
+ }
+ else {
+ // utf8 message: convert to ansi and encrypt.
+ LPWSTR wstring = utf8decode(szOldMsg);
+ int wlen = wcslen(wstring)+1;
+ LPSTR astring = (LPSTR) alloca(wlen);
+ WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, 0, 0);
+ szNewMsg = cpp_encrypt(ptr, astring);
+ }
+
+ return szNewMsg;
+}
+
+// encode message from UNICODE into UTF8 if need
+LPSTR __cdecl cpp_encodeW(HANDLE context, LPWSTR msg)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return NULL;
+ cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA) ptr->pdata;
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+
+ LPSTR szNewMsg = NULL;
+ LPSTR szOldMsg = (LPSTR) msg;
+
+ if (ptr->features & FEATURES_UTF8) {
+ // unicode message: convert to utf-8 and encrypt.
+ szNewMsg = cpp_encrypt(ptr, utf8encode((LPWSTR)szOldMsg));
+ }
+ else {
+ // unicode message: convert to ansi and encrypt.
+ int wlen = wcslen((LPWSTR)szOldMsg)+1;
+ LPSTR astring = (LPSTR) alloca(wlen);
+ WideCharToMultiByte(CP_ACP, 0, (LPWSTR)szOldMsg, -1, astring, wlen, 0, 0);
+ szNewMsg = cpp_encrypt(ptr, astring);
+ }
+
+ return szNewMsg;
+}
+
+
+// decode message from UTF8 if need, return ANSIzUCS2z
+LPSTR __cdecl cpp_decode(HANDLE context, LPCSTR szEncMsg)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return NULL;
+ cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA) ptr->pdata;
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+
+ LPSTR szNewMsg = NULL;
+ LPSTR szOldMsg = cpp_decrypt(ptr, szEncMsg);
+
+ if (szOldMsg) {
+ if (ptr->features & FEATURES_UTF8) {
+ // utf8 message: convert to unicode -> ansii
+ LPWSTR wstring = utf8decode(szOldMsg);
+ int wlen = wcslen(wstring)+1;
+ szNewMsg = (LPSTR) malloc(wlen*(sizeof(WCHAR)+2)); // work.zy@gmail.com
+ WideCharToMultiByte(CP_ACP, 0, wstring, -1, szNewMsg, wlen, 0, 0);
+ memcpy(szNewMsg+strlen(szNewMsg)+1, wstring, wlen*sizeof(WCHAR)); // work.zy@gmail.com
+ }
+ else {
+ // ansi message: convert to unicode
+ int slen = strlen(szOldMsg)+1;
+ szNewMsg = (LPSTR) malloc(slen*(sizeof(WCHAR)+1));
+ memcpy(szNewMsg,szOldMsg,slen);
+ WCHAR* wstring = (LPWSTR) alloca(slen*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(WCHAR));
+ memcpy(szNewMsg+slen,wstring,slen*sizeof(WCHAR));
+ }
+ }
+ SAFE_FREE(ptr->tmp);
+ ptr->tmp = szNewMsg;
+ return szNewMsg;
+}
+
+// decode message return UTF8z
+LPSTR __cdecl cpp_decodeU(HANDLE context, LPCSTR szEncMsg)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return NULL;
+ cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA) ptr->pdata;
+ if (!p->KeyX) { ptr->error = ERROR_NO_KEYX; return NULL; }
+
+ LPSTR szNewMsg = NULL;
+ LPSTR szOldMsg = cpp_decrypt(ptr, szEncMsg);
+
+ if (szOldMsg) {
+ if (ptr->features & FEATURES_UTF8) {
+ // utf8 message: copy
+ szNewMsg = _strdup(szOldMsg);
+ }
+ else {
+ // ansi message: convert to utf8
+ int slen = strlen(szOldMsg)+1;
+ LPWSTR wstring = (LPWSTR) alloca(slen*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(WCHAR));
+ szNewMsg = _strdup(utf8encode(wstring));
+ }
+ }
+ SAFE_FREE(ptr->tmp);
+ ptr->tmp = szNewMsg;
+ return szNewMsg;
+}
+
+int __cdecl cpp_encrypt_file(HANDLE context,LPCSTR file_in,LPCSTR file_out)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return 0;
+ cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA) ptr->pdata;
+ if (!p->KeyX) return 0;
+
+ try{
+ CBC_Mode<AES>::Encryption enc(p->KeyX,Tiger::DIGESTSIZE,IV);
+ FileSource *f = new FileSource(file_in,true,new StreamTransformationFilter (enc,new FileSink(file_out)));
+ delete f;
+ }
+ catch (...) {
+ return 0;
+ }
+ return 1;
+}
+
+int __cdecl cpp_decrypt_file(HANDLE context,LPCSTR file_in,LPCSTR file_out)
+{
+ pCNTX ptr = get_context_on_id(context);
+ if (!ptr) return 0;
+ cpp_alloc_pdata(ptr); pSIMDATA p = (pSIMDATA) ptr->pdata;
+ if (!p->KeyX) return 0;
+
+ try{
+ CBC_Mode<AES>::Decryption dec(p->KeyX,Tiger::DIGESTSIZE,IV);
+ FileSource *f = new FileSource(file_in,true,new StreamTransformationFilter (dec,new FileSink(file_out)));
+ delete f;
+ }
+ catch (...) {
+ return 0;
+ }
+ return 1;
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/cryptopp.h b/plugins/CryptoPP/src/cryptopp.h new file mode 100644 index 0000000000..8657e29c6a --- /dev/null +++ b/plugins/CryptoPP/src/cryptopp.h @@ -0,0 +1,204 @@ +#ifndef __CRYPTOPP_H__
+#define __CRYPTOPP_H__
+
+#include <queue>
+#include <deque>
+#include <list>
+#include <map>
+
+#pragma warning(disable: 4231 4250 4251 4275 4660 4661 4700 4706 4786 4355)
+#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
+#include "../crypto/src/modes.h"
+#include "../crypto/src/osrng.h"
+#include "../crypto/src/rsa.h"
+#include "../crypto/src/aes.h"
+#include "../crypto/src/dh.h"
+#include "../crypto/src/crc.h"
+#include "../crypto/src/ripemd.h"
+#include "../crypto/src/sha.h"
+#include "../crypto/src/tiger.h"
+#include "../crypto/src/gzip.h"
+#include "../crypto/src/zlib.h"
+#include "../crypto/src/files.h"
+
+USING_NAMESPACE(CryptoPP);
+USING_NAMESPACE(std)
+
+#define KEYSIZE 256
+#define DEFMSGS 4096
+
+#define HEADER 0xABCD1234
+#define FOOTER 0x9876FEDC
+#define EMPTYH 0xF1E2D3C4
+
+typedef struct __CNTX {
+ u_int header; // HEADER
+ short mode; // mode of encoding
+ short features; // features of client
+ short error; // error code of last operation
+ PBYTE pdata; // data block
+ PVOID udata; // user data
+ LPSTR tmp; // return string
+ u_int deleted; // delete time&flag to delete
+ u_int footer; // FOOTER
+} CNTX;
+typedef CNTX* pCNTX;
+
+
+#define FEATURES_UTF8 0x01
+#define FEATURES_BASE64 0x02
+#define FEATURES_GZIP 0x04
+#define FEATURES_CRC32 0x08
+#define FEATURES_PSK 0x10
+#define FEATURES_NEWPG 0x20
+#define FEATURES_RSA 0x40
+
+#define MODE_BASE16 0x0000
+#define MODE_BASE64 0x0001
+#define MODE_PGP 0x0002
+#define MODE_GPG 0x0004
+#define MODE_GPG_ANSI 0x0008
+#define MODE_PRIV_KEY 0x0010
+#define MODE_RSA_2048 0x0020
+#define MODE_RSA_4096 0x0040
+#define MODE_RSA MODE_RSA_4096
+#define MODE_RSA_ONLY 0x0080
+#define MODE_RSA_ZLIB 0x0100
+#define MODE_RSA_BER 0x0200
+
+#define DATA_GZIP 1
+
+typedef struct __SIMDATA {
+ DH *dh; // diffie-hellman
+ PBYTE PubA; // public keyA 2048 bit
+ PBYTE KeyA; // private keyA 2048 bit
+ PBYTE KeyB; // public keyB 2048 bit
+ PBYTE KeyX; // secret keyX 192 bit
+ PBYTE KeyP; // pre-shared keyP 192 bit
+} SIMDATA;
+typedef SIMDATA* pSIMDATA;
+
+
+typedef struct __PGPDATA {
+ PBYTE pgpKeyID; // PGP KeyID
+ PBYTE pgpKey; // PGP Key
+} PGPDATA;
+typedef PGPDATA* pPGPDATA;
+
+
+typedef struct __GPGDATA {
+ BYTE *gpgKeyID; // GPG KeyID
+} GPGDATA;
+typedef GPGDATA* pGPGDATA;
+
+
+#define RSA_KEYSIZE SHA1::DIGESTSIZE
+#define RSA_CalculateDigest SHA1().CalculateDigest
+
+
+typedef struct __RSAPRIV {
+ string priv_k; // private key string
+ string priv_s; // hash(priv_k)
+ RSA::PrivateKey priv; // private key
+ string pub_k; // public key string
+ string pub_s; // hash(pub_k)
+} RSAPRIV;
+typedef RSAPRIV* pRSAPRIV;
+
+
+typedef deque<string, allocator<string> > STRINGDEQUE;
+typedef queue<string,STRINGDEQUE> STRINGQUEUE;
+
+
+typedef struct __RSADATA {
+ short state; // 0 - нифига нет, 1..6 - keyexchange, 7 - соединение установлено
+ u_int time; // для прерывания keyexchange, если долго нет ответа
+ string pub_k; // public key string
+ string pub_s; // hash(pub_k)
+ RSA::PublicKey pub; // public key
+ string aes_k; // aes key
+ string aes_v; // aes iv
+ HANDLE thread; // thread handle
+ BOOL thread_exit;
+ HANDLE event; // thread event
+ STRINGQUEUE *queue; // thread queue
+} RSADATA;
+typedef RSADATA* pRSADATA;
+
+
+#define ERROR_NONE 0
+#define ERROR_SEH 1
+#define ERROR_NO_KEYA 2
+#define ERROR_NO_KEYB 3
+#define ERROR_NO_KEYX 4
+#define ERROR_BAD_LEN 5
+#define ERROR_BAD_CRC 6
+#define ERROR_NO_PSK 7
+#define ERROR_BAD_PSK 8
+#define ERROR_BAD_KEYB 9
+#define ERROR_NO_PGP_KEY 10
+#define ERROR_NO_PGP_PASS 11
+#define ERROR_NO_GPG_KEY 12
+#define ERROR_NO_GPG_PASS 13
+
+#if defined(_DEBUG)
+#define FEATURES (FEATURES_UTF8 | FEATURES_BASE64 | FEATURES_GZIP | FEATURES_CRC32 | FEATURES_NEWPG)
+#else
+#define FEATURES (FEATURES_UTF8 | FEATURES_BASE64 | FEATURES_GZIP | FEATURES_CRC32 | FEATURES_NEWPG | FEATURES_RSA)
+#endif
+
+#define DLLEXPORT __declspec(dllexport)
+
+extern LPCSTR szModuleName;
+extern LPCSTR szVersionStr;
+extern HINSTANCE g_hInst;
+
+pCNTX get_context_on_id(int);
+pCNTX get_context_on_id(HANDLE);
+void cpp_free_keys(pCNTX);
+BYTE *cpp_gzip(BYTE*,size_t,size_t&);
+BYTE *cpp_gunzip(BYTE*,size_t,size_t&);
+string cpp_zlibc(string&);
+string cpp_zlibd(string&);
+
+typedef struct {
+ int (__cdecl *rsa_gen_keypair)(short); // генерит RSA-ключи для указанной длины (либо тока 2048, либо 2048 и 4096)
+ int (__cdecl *rsa_get_keypair)(short,PBYTE,int*,PBYTE,int*); // возвращает пару ключей для указанной длины
+ int (__cdecl *rsa_get_keyhash)(short,PBYTE,int*,PBYTE,int*); // возвращает hash пары ключей для указанной длины
+ int (__cdecl *rsa_set_keypair)(short,PBYTE,int); // устанавливает ключи, указанной длины
+ int (__cdecl *rsa_get_pubkey)(HANDLE,PBYTE,int*); // возвращает паблик ключ из указанного контекста
+ int (__cdecl *rsa_set_pubkey)(HANDLE,PBYTE,int); // загружает паблик ключ для указанного контекста
+ void (__cdecl *rsa_set_timeout)(int); // установить таймаут для установки секюрного соединения
+ int (__cdecl *rsa_get_state)(HANDLE); // получить статус указанного контекста
+ int (__cdecl *rsa_get_hash)(PBYTE,int,PBYTE,int*); // вычисляет SHA1(key)
+ int (__cdecl *rsa_connect)(HANDLE); // запускает процесс установки содинения с указанным контекстом
+ int (__cdecl *rsa_disconnect)(HANDLE); // разрывает соединение с указанным контекстом
+ int (__cdecl *rsa_disabled)(HANDLE); // разрывает соединение по причине "disabled"
+ LPSTR (__cdecl *rsa_recv)(HANDLE,LPCSTR); // необходимо передавать сюда все входящие протокольные сообщения
+ int (__cdecl *rsa_send)(HANDLE,LPCSTR); // вызываем для отправки сообщения клиенту
+ int (__cdecl *rsa_encrypt_file)(HANDLE,LPCSTR,LPCSTR);
+ int (__cdecl *rsa_decrypt_file)(HANDLE,LPCSTR,LPCSTR);
+ LPSTR (__cdecl *utf8encode)(LPCWSTR);
+ LPWSTR (__cdecl *utf8decode)(LPCSTR);
+ int (__cdecl *is_7bit_string)(LPCSTR);
+ int (__cdecl *is_utf8_string)(LPCSTR);
+ int (__cdecl *rsa_export_keypair)(short,LPSTR,LPSTR,LPSTR); // export private key
+ int (__cdecl *rsa_import_keypair)(short,LPSTR,LPSTR); // import & activate private key
+ int (__cdecl *rsa_export_pubkey)(HANDLE,LPSTR); // export public key from context
+ int (__cdecl *rsa_import_pubkey)(HANDLE,LPSTR); // import public key into context
+} RSA_EXPORT;
+typedef RSA_EXPORT* pRSA_EXPORT;
+
+typedef struct {
+ int (__cdecl *rsa_inject)(HANDLE,LPCSTR); // вставляет сообщение в очередь на отправку
+ int (__cdecl *rsa_check_pub)(HANDLE,PBYTE,int,PBYTE,int); // проверяет интерактивно SHA и сохраняет ключ, если все нормально
+ void (__cdecl *rsa_notify)(HANDLE,int); // нотификация о смене состояния
+} RSA_IMPORT;
+typedef RSA_IMPORT* pRSA_IMPORT;
+
+NAMESPACE_BEGIN(CryptoPP)
+typedef RSASS<PKCS1v15, SHA256>::Signer RSASSA_PKCS1v15_SHA256_Signer;
+typedef RSASS<PKCS1v15, SHA256>::Verifier RSASSA_PKCS1v15_SHA256_Verifier;
+NAMESPACE_END
+
+#endif
diff --git a/plugins/CryptoPP/src/dllloader.cpp b/plugins/CryptoPP/src/dllloader.cpp new file mode 100644 index 0000000000..160e5d98c4 --- /dev/null +++ b/plugins/CryptoPP/src/dllloader.cpp @@ -0,0 +1,280 @@ +/*
+* Loading dll from memory
+*
+* Written by Vitaliy Shitts (vit@shittz.ru)
+* Copyright (c) 2004 Vitaliy Shittz.
+*
+* THIS CODE IS PROVIDED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED
+* OR IMPLIED. YOU USE AT YOUR OWN RISK. THE AUTHOR ACCEPTS NO LIABILITY
+* IF IT CAUSES ANY DAMAGE TO YOU OR YOUR COMPUTER WHATSOEVER.
+*
+* Beware of bugs.
+*/
+
+#include "commonheaders.h"
+
+#ifdef DLL_FROM_RESOURCE
+
+#ifndef MIN
+# define MIN(a,b) ((a)<(b)?(a):(b))
+#endif
+
+typedef BOOL (WINAPI *DLLMAIN)(HINSTANCE,DWORD,LPVOID);
+
+#pragma warning (push)
+#pragma warning (disable: 4311; disable: 4312; disable: 4018)
+
+DWORD GetSectionProtection(DWORD sc)
+{
+ DWORD dwResult=0;
+ if (sc & IMAGE_SCN_MEM_NOT_CACHED)
+ dwResult |= PAGE_NOCACHE;
+
+ if (sc & IMAGE_SCN_MEM_EXECUTE)
+ {
+ if (sc & IMAGE_SCN_MEM_READ)
+ {
+ if (sc & IMAGE_SCN_MEM_WRITE)
+ dwResult |= PAGE_EXECUTE_READWRITE;
+ else
+ dwResult |= PAGE_EXECUTE_READ;
+ }
+ else
+ {
+ if (sc & IMAGE_SCN_MEM_WRITE)
+ dwResult |= PAGE_EXECUTE_WRITECOPY;
+ else
+ dwResult |= PAGE_EXECUTE;
+ }
+ }
+ else
+ {
+ if (sc & IMAGE_SCN_MEM_READ)
+ {
+ if (sc & IMAGE_SCN_MEM_WRITE)
+ dwResult|=PAGE_READWRITE;
+ else
+ dwResult|=PAGE_READONLY;
+ }
+ else
+ {
+ if (sc & IMAGE_SCN_MEM_WRITE)
+ dwResult|=PAGE_WRITECOPY;
+ else
+ dwResult|=PAGE_NOACCESS;
+ }
+ }
+
+ return dwResult;
+}
+
+inline BOOL IsImportByOrdinal(DWORD ImportDescriptor)
+{
+ return (ImportDescriptor & IMAGE_ORDINAL_FLAG32)!=0;
+}
+
+
+HMODULE MemLoadLibrary(PBYTE data)
+{
+ IMAGE_FILE_HEADER *pFileHeader = NULL;
+ IMAGE_OPTIONAL_HEADER *pOptionalHeader = NULL;
+ IMAGE_SECTION_HEADER *pSectionHeader = NULL;
+ IMAGE_IMPORT_DESCRIPTOR *pImportDscrtr = NULL;
+ USHORT e_lfanew = *((USHORT*)(data+0x3c));
+ PCHAR ImageBase = NULL;
+ PCHAR SectionBase = NULL;
+
+ DWORD dwSize, dwOldProt, ImageBaseDelta;
+ int i;
+
+ pFileHeader = (IMAGE_FILE_HEADER *)(data+e_lfanew+4);
+ pOptionalHeader = (IMAGE_OPTIONAL_HEADER *)(data+e_lfanew+4+sizeof(IMAGE_FILE_HEADER));
+ if (pOptionalHeader->Magic!=IMAGE_NT_OPTIONAL_HDR32_MAGIC)
+ return NULL;
+
+ // Let's try to reserv memory
+ ImageBase = (PCHAR)VirtualAlloc(
+ (PVOID)pOptionalHeader->ImageBase,
+ pOptionalHeader->SizeOfImage,
+ MEM_RESERVE,PAGE_NOACCESS);
+
+ if (ImageBase==NULL)
+ {
+ ImageBase=(PCHAR)VirtualAlloc(NULL,
+ pOptionalHeader->SizeOfImage,
+ MEM_RESERVE,PAGE_NOACCESS);
+ if (ImageBase==NULL)
+ return NULL;
+ }
+
+ // copy the header
+ SectionBase=(PCHAR)VirtualAlloc(ImageBase,
+ pOptionalHeader->SizeOfHeaders,
+ MEM_COMMIT,PAGE_READWRITE);
+ memcpy(SectionBase,data,pOptionalHeader->SizeOfHeaders);
+ // Do headers read-only (to be on the safe side)
+ VirtualProtect(SectionBase,pOptionalHeader->SizeOfHeaders,PAGE_READONLY,&dwOldProt);
+
+ // find sections ...
+ pSectionHeader = (IMAGE_SECTION_HEADER *)(pOptionalHeader+1);
+ for (i=0; i<pFileHeader->NumberOfSections; i++)
+ {
+ SectionBase = (PCHAR)VirtualAlloc(
+ ImageBase+pSectionHeader[i].VirtualAddress,
+ pSectionHeader[i].Misc.VirtualSize,
+ MEM_COMMIT,PAGE_READWRITE);
+ if (SectionBase==NULL)
+ {
+ VirtualFree(ImageBase, 0, MEM_RELEASE);
+ return NULL;
+ }
+ // ... and copy initialization data
+ SectionBase = ImageBase+pSectionHeader[i].VirtualAddress;
+ dwSize = MIN(pSectionHeader[i].SizeOfRawData,pSectionHeader[i].Misc.VirtualSize);
+ memcpy(SectionBase, data+pSectionHeader[i].PointerToRawData,dwSize);
+ }
+
+ // check addersses
+ ImageBaseDelta = (DWORD)ImageBase-pOptionalHeader->ImageBase;
+ if (ImageBaseDelta!=0 &&
+ pOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress!=0
+ )
+ {
+ IMAGE_BASE_RELOCATION *pBaseReloc = (IMAGE_BASE_RELOCATION *)(ImageBase+
+ pOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress);
+ IMAGE_BASE_RELOCATION *pBaseReloc0 = pBaseReloc;
+ WORD *wPointer = NULL;
+ DWORD dwModCount;
+ int i;
+
+ while ((DWORD)pBaseReloc0-(DWORD)pBaseReloc < pOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size)
+ {
+ dwModCount = (pBaseReloc0->SizeOfBlock-sizeof(pBaseReloc))/2;
+ wPointer = (WORD *)(pBaseReloc+1);
+ for (i=0; i<dwModCount; i++, wPointer++)
+ if ((*wPointer & 0xf000) !=0)
+ {
+ PDWORD pdw = (PDWORD)(ImageBase+pBaseReloc0->VirtualAddress+((*wPointer)&0xfff));
+ (*pdw)+=ImageBaseDelta;
+ }
+ pBaseReloc = (IMAGE_BASE_RELOCATION *)wPointer;
+ }
+ }
+ else if (ImageBaseDelta!=0)
+ {
+ VirtualFree(ImageBase, 0, MEM_RELEASE);
+ return NULL;
+ }
+
+ pImportDscrtr = (IMAGE_IMPORT_DESCRIPTOR *)(ImageBase+
+ pOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
+
+ for (;pImportDscrtr->Name!=0; pImportDscrtr++)
+ {
+ PCHAR pLibName = (PCHAR)(ImageBase+pImportDscrtr->Name);
+ PCHAR pImortName = NULL;
+ HMODULE hLibModule = LoadLibrary(pLibName);
+ DWORD *pImport = NULL,
+ *pAddress = NULL;
+ DWORD ProcAddress;
+
+ pAddress=(DWORD *)(ImageBase+pImportDscrtr->/*Original*/FirstThunk);
+ if (pImportDscrtr->TimeDateStamp==0)
+ pImport=(DWORD *)(ImageBase+pImportDscrtr->FirstThunk);
+ else
+ pImport=(DWORD *)(ImageBase+pImportDscrtr->OriginalFirstThunk);
+ for (i=0; pImport[i]!=0; i++)
+ {
+ if (IsImportByOrdinal(pImport[i]))
+ ProcAddress=(DWORD)GetProcAddress(hLibModule, (PCHAR)(pImport[i]&0xFFFF));
+ else // import by name
+ {
+ pImortName=(PCHAR)(ImageBase+(pImport[i])+2);
+ ProcAddress=(DWORD)GetProcAddress(hLibModule, pImortName);
+ }
+ pAddress[i]=ProcAddress;
+ }
+ }
+
+ // set section protection
+ for (i=0; i<pFileHeader->NumberOfSections; i++)
+ VirtualProtect((PVOID)(ImageBase+pSectionHeader[i].VirtualAddress),
+ pSectionHeader[i].Misc.VirtualSize,
+ GetSectionProtection(pSectionHeader[i].Characteristics),
+ &dwOldProt);
+
+ // call DLLMain
+ if (pOptionalHeader->AddressOfEntryPoint!=0)
+ {
+ DLLMAIN dllMain=(DLLMAIN)(ImageBase+pOptionalHeader->AddressOfEntryPoint);
+ if (!dllMain((HMODULE)ImageBase, DLL_PROCESS_ATTACH, NULL))
+ {
+ VirtualFree(ImageBase, 0, MEM_RELEASE);
+ return NULL;
+ }
+ }
+
+ return (HMODULE)ImageBase;
+}
+
+
+BOOL MemFreeLibrary(HMODULE hDll)
+{
+ PIMAGE_DOS_HEADER pDosHeader = NULL;
+ PIMAGE_FILE_HEADER pFileHeader = NULL;
+ PIMAGE_OPTIONAL_HEADER pOptionalHeader = NULL;
+
+ pDosHeader=(PIMAGE_DOS_HEADER)hDll;
+ pFileHeader=(PIMAGE_FILE_HEADER)(((PBYTE)hDll)+pDosHeader->e_lfanew+4);
+ pOptionalHeader=(PIMAGE_OPTIONAL_HEADER)(pFileHeader+1);
+
+// Call to DllMain
+ if (pOptionalHeader->AddressOfEntryPoint!=0)
+ {
+ DLLMAIN dllMain=(DLLMAIN)((PBYTE)hDll+pOptionalHeader->AddressOfEntryPoint);
+ dllMain(hDll, DLL_PROCESS_DETACH, NULL);
+ }
+// free loaded librares
+ PIMAGE_IMPORT_DESCRIPTOR pImportDscrtr = (IMAGE_IMPORT_DESCRIPTOR *)((PBYTE)hDll+
+ pOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
+ for (;pImportDscrtr->Name!=0; pImportDscrtr++)
+ {
+ PCHAR pLibName = (PCHAR)((PBYTE)hDll+pImportDscrtr->Name);
+ HMODULE hLib = GetModuleHandle(pLibName);
+ FreeLibrary(hLib);
+ }
+
+ return VirtualFree((PVOID)hDll, 0, MEM_RELEASE);
+}
+
+FARPROC MemGetProcAddress(HMODULE hDll, LPCTSTR fname)
+{
+ PIMAGE_DOS_HEADER pDosHeader = NULL;
+ PIMAGE_FILE_HEADER pFileHeader = NULL;
+ PIMAGE_OPTIONAL_HEADER pOptionalHeader = NULL;
+
+ pDosHeader=(PIMAGE_DOS_HEADER)hDll;
+ pFileHeader=(PIMAGE_FILE_HEADER)(((PBYTE)hDll)+pDosHeader->e_lfanew+4);
+ pOptionalHeader=(PIMAGE_OPTIONAL_HEADER)(pFileHeader+1);
+
+ DWORD dwExpRVA = pOptionalHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ PBYTE pb = (PBYTE)hDll;
+ PIMAGE_EXPORT_DIRECTORY pExportDir=(PIMAGE_EXPORT_DIRECTORY)(pb+dwExpRVA);
+ PDWORD pNamesRVA=(PDWORD)(pb+pExportDir->AddressOfNames);
+ PDWORD pFuncRVA=(PDWORD)(pb+pExportDir->AddressOfFunctions);
+ PWORD ord=(PWORD)(pb+pExportDir->AddressOfNameOrdinals);
+
+ DWORD dwFunc=pExportDir->NumberOfNames;
+ for (int i=0; i<dwFunc; i++)
+ {
+ PCHAR name =((PCHAR)(pb+pNamesRVA[i]));
+ if (0==strcmp(fname, name))
+ return (FARPROC)(pb+pFuncRVA[ord[i]]);
+ }
+
+ return NULL;
+}
+
+#pragma warning (pop)
+
+#endif
diff --git a/plugins/CryptoPP/src/dllloader.h b/plugins/CryptoPP/src/dllloader.h new file mode 100644 index 0000000000..0563810248 --- /dev/null +++ b/plugins/CryptoPP/src/dllloader.h @@ -0,0 +1,8 @@ +#ifndef __DLLLOADER_H__
+#define __DLLLOADER__H__
+
+HMODULE MemLoadLibrary(PBYTE data);
+BOOL MemFreeLibrary(HMODULE hDll);
+FARPROC MemGetProcAddress(HMODULE hDll, LPCTSTR fname);
+
+#endif
diff --git a/plugins/CryptoPP/src/gettime.cpp b/plugins/CryptoPP/src/gettime.cpp new file mode 100644 index 0000000000..5b44d84301 --- /dev/null +++ b/plugins/CryptoPP/src/gettime.cpp @@ -0,0 +1,29 @@ +#include "commonheaders.h"
+
+
+/* FILETIME unit is 100 nanoseconds */
+const static long div_100_nsec = 10000000;
+
+/* POSIX or Unix Epoch (1-Jan-1970 00:00) in FILETIME units */
+#ifdef _MSC_VER
+const static ULONGLONG ix_epoch = 116444736000000000;
+#else
+const static ULONGLONG ix_epoch = 116444736000000000LL;
+#endif
+
+u_int gettime(void) {
+
+ ULONGLONG diff_100_nsec;
+ union {
+ FILETIME f;
+ ULARGE_INTEGER u;
+ } now;
+
+ GetSystemTimeAsFileTime( &now.f );
+
+ diff_100_nsec = now.u.QuadPart - ix_epoch;
+
+ return (u_int)( diff_100_nsec / div_100_nsec );
+}
+
+// EOF
diff --git a/plugins/CryptoPP/src/gettime.h b/plugins/CryptoPP/src/gettime.h new file mode 100644 index 0000000000..00c8d90915 --- /dev/null +++ b/plugins/CryptoPP/src/gettime.h @@ -0,0 +1,8 @@ +#ifndef __GETTIME_H__
+#define __GETTIME_H__
+
+#include <windows.h>
+
+u_int gettime(void);
+
+#endif
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp new file mode 100644 index 0000000000..a5613db216 --- /dev/null +++ b/plugins/CryptoPP/src/main.cpp @@ -0,0 +1,74 @@ +#include "commonheaders.h"
+
+int hLangpack;
+
+// dllmain
+BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID)
+{
+ if ( dwReason == DLL_PROCESS_ATTACH ) {
+ g_hInst = hInst;
+
+ char temp[MAX_PATH];
+ GetTempPath(sizeof(temp),temp);
+ GetLongPathName(temp,TEMP,sizeof(TEMP));
+ TEMP_SIZE = strlen(TEMP);
+ if (TEMP[TEMP_SIZE-1]=='\\') {
+ TEMP_SIZE--;
+ TEMP[TEMP_SIZE]='\0';
+ }
+ InitializeCriticalSection(&localQueueMutex);
+ InitializeCriticalSection(&localContextMutex);
+#ifdef _DEBUG
+ isVista = 1;
+#else
+ isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
+#endif
+ }
+ //DLL_THREAD_ATTACH
+ return TRUE;
+}
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_CRYPTOPP, MIID_LAST};
+
+PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ return &pluginInfoEx;
+}
+
+int onModulesLoaded(WPARAM wParam,LPARAM lParam)
+{
+ // updater plugin support
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+ InitNetlib();
+#endif
+ return 0;
+}
+
+int Load()
+{
+ DisableThreadLibraryCalls(g_hInst);
+
+ // get memoryManagerInterface address
+ mir_getLP(&pluginInfoEx);
+
+ // register plugin module
+ PROTOCOLDESCRIPTOR pd;
+ memset(&pd,0,sizeof(pd));
+ pd.cbSize = sizeof(pd);
+ pd.szName = (char*)szModuleName;
+ pd.type = PROTOTYPE_ENCRYPTION;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+
+ // hook events
+ HookEvent(ME_SYSTEM_MODULESLOADED,onModulesLoaded);
+ return 0;
+}
+
+
+int Unload()
+{
+ return 0;
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/mmi.cpp b/plugins/CryptoPP/src/mmi.cpp new file mode 100644 index 0000000000..68026578bb --- /dev/null +++ b/plugins/CryptoPP/src/mmi.cpp @@ -0,0 +1,88 @@ +#include "commonheaders.h"
+
+/*
+void m_check(void *ptr, const char *module) {
+ if (ptr==NULL) {
+ char buffer[128];
+ strcpy(buffer,module); strcat(buffer,": NULL pointer detected !");
+ MessageBoxA(0,buffer,szModuleName,MB_OK|MB_ICONSTOP);
+ __asm{ int 3 };
+ exit(1);
+ }
+}
+
+
+void *m_alloc(size_t size) {
+ void *ptr;
+ ptr = malloc(size);
+ m_check(ptr,"m_alloc");
+ ZeroMemory(ptr,size);
+ return ptr;
+}
+
+
+void m_free(void *ptr) {
+// m_check(ptr,"m_free");
+ if (ptr) {
+ free(ptr);
+ }
+}
+
+
+void *m_realloc(void *ptr,size_t size) {
+ r = realloc(ptr,size);
+ m_check(ptr,"m_realloc");
+ return ptr;
+}
+
+
+#ifndef _DEBUG
+void *operator new(size_t size) {
+ return malloc(size);
+}
+#endif
+
+
+void operator delete(void *p) {
+ free(p);
+}
+
+
+void *operator new[](size_t size) {
+ return operator new(size);
+}
+
+
+void operator delete[](void *p) {
+ operator delete(p);
+}
+
+
+char *m_strdup(const char *str) {
+ if (str==NULL) return NULL;
+ int len = (int)strlen(str)+1;
+ char *dup = (char*) m_alloc(len);
+ MoveMemory((void*)dup,(void*)str,len);
+ return dup;
+}
+*/
+
+void __fastcall safe_free(void** p)
+{
+ if (*p) {
+ free(*p);
+ *p = NULL;
+ }
+}
+
+
+void __fastcall safe_delete(void** p)
+{
+ if (*p) {
+ delete(*p);
+ *p = NULL;
+ }
+}
+
+
+// EOF
diff --git a/plugins/CryptoPP/src/mmi.h b/plugins/CryptoPP/src/mmi.h new file mode 100644 index 0000000000..1ea57eb621 --- /dev/null +++ b/plugins/CryptoPP/src/mmi.h @@ -0,0 +1,22 @@ +#ifndef __MMI_H__
+#define __MMI_H__
+/*
+void *m_alloc(size_t);
+void m_free(void *);
+void *m_realloc(void *,size_t);
+char *m_strdup(const char *);
+
+void *operator new(size_t sz);
+void operator delete(void *p);
+void *operator new[](size_t size);
+void operator delete[](void * p);
+*/
+
+#define SAFE_INIT(t,p) t p=NULL;
+#define SAFE_FREE(p) safe_free((void **)&(p));
+#define SAFE_DELETE(p) safe_delete((void **)&(p));
+
+void __fastcall safe_free(void** p);
+void __fastcall safe_delete(void** p);
+
+#endif
diff --git a/plugins/CryptoPP/src/resource.h b/plugins/CryptoPP/src/resource.h new file mode 100644 index 0000000000..106d77a2ca --- /dev/null +++ b/plugins/CryptoPP/src/resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by resource.rc
+//
+// Next default values for new objects
+//
+
+#define DLL_FROM_RESOURCE 1
+
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 100
+#define _APS_NEXT_COMMAND_VALUE 40000
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 100
+#endif
+#endif
diff --git a/plugins/CryptoPP/src/utf8.cpp b/plugins/CryptoPP/src/utf8.cpp new file mode 100644 index 0000000000..e071e3aaeb --- /dev/null +++ b/plugins/CryptoPP/src/utf8.cpp @@ -0,0 +1,149 @@ +#include "commonheaders.h"
+
+LPSTR szOut = NULL;
+LPWSTR wszOut = NULL;
+
+LPSTR __cdecl utf8encode(LPCWSTR str) {
+
+// LPSTR szOut;
+ LPWSTR wszTemp, w;
+ int len, i;
+
+ if (str == NULL)
+ return NULL;
+
+ wszTemp = (LPWSTR)str;
+
+ len = 0;
+ for (w=wszTemp; *w; w++) {
+ if (*w < 0x0080) len++;
+ else if (*w < 0x0800) len += 2;
+ else len += 3;
+ }
+
+ SAFE_FREE(szOut);
+ if ((szOut = (LPSTR) malloc(len + 1)) == NULL)
+ return NULL;
+
+ i = 0;
+ for (w=wszTemp; *w; w++) {
+ if (*w < 0x0080)
+ szOut[i++] = (BYTE) *w;
+ else if (*w < 0x0800) {
+ szOut[i++] = 0xc0 | (((*w) >> 6) &0x3f);
+ szOut[i++] = 0x80 | ((*w) & 0x3f);
+ }
+ else {
+ szOut[i++] = 0xe0 | ((*w) >> 12);
+ szOut[i++] = 0x80 | (((*w) >> 6) & 0x3f);
+ szOut[i++] = 0x80 | ((*w) & 0x3f);
+ }
+ }
+ szOut[i] = '\0';
+ return szOut;
+}
+
+LPWSTR __cdecl utf8decode(LPCSTR str) {
+
+ int i, len;
+ LPSTR p;
+// LPWSTR wszOut;
+
+ if (str == NULL) return NULL;
+
+ len = strlen(str)+1;
+
+ SAFE_FREE(wszOut);
+ if ((wszOut = (LPWSTR) malloc(len*sizeof(WCHAR))) == NULL)
+ return NULL;
+ p = (LPSTR)str;
+ i = 0;
+ while (*p) {
+ if ((p[0] & 0x80) == 0) {
+ wszOut[i++] = *(p++);
+ continue;
+ }
+ if ((p[0] & 0xe0) == 0xe0 && (p[1] & 0xc0) == 0x80 && (p[2] & 0xc0) == 0x80) {
+ wszOut[i] = (*(p++) & 0x0f) << 12;
+ wszOut[i] |= (*(p++) & 0x3f) << 6;
+ wszOut[i++] |= (*(p++) & 0x3f);
+ continue;
+ }
+ if ((p[0] & 0xe0) == 0xc0 && (p[1] & 0xc0) == 0x80) {
+ wszOut[i] = (*(p++) & 0x1f) << 6;
+ wszOut[i++] |= (*(p++) & 0x3f);
+ continue;
+ }
+ wszOut[i++] = *p++;
+ }
+ wszOut[i] = '\0';
+
+ return wszOut;
+}
+
+
+// Returns true if the buffer only contains 7-bit characters.
+int __cdecl is_7bit_string(LPCSTR str) {
+ while( *str ) {
+ if ( *str & 0x80 ) {
+ return FALSE;
+ break;
+ }
+ str++;
+ }
+
+ return TRUE;
+}
+
+
+//Copyright (C) 2001, 2002 Peter Verthez
+//under GNU LGPL
+int __cdecl is_utf8_string(LPCSTR str) {
+ int expect_bytes = 0;
+
+ if (!str) return 0;
+
+ while (*str) {
+ if ((*str & 0x80) == 0) {
+ /* Looks like an ASCII character */
+ if (expect_bytes)
+ /* byte of UTF-8 character expected */
+ return 0;
+ else {
+ /* OK, ASCII character expected */
+ str++;
+ }
+ }
+ else {
+ /* Looks like byte of an UTF-8 character */
+ if (expect_bytes) {
+ /* expect_bytes already set: first byte of UTF-8 char already seen */
+ if ((*str & 0xC0) == 0x80) {
+ /* OK, next byte of UTF-8 character */
+ /* Decrement number of expected bytes */
+ expect_bytes--;
+ str++;
+ }
+ else {
+ /* again first byte ?!?! */
+ return 0;
+ }
+ }
+ else {
+ /* First byte of the UTF-8 character */
+ /* count initial one bits and set expect_bytes to 1 less */
+ char ch = *str;
+ while (ch & 0x80) {
+ expect_bytes++;
+ ch = (ch & 0x7f) << 1;
+ }
+ expect_bytes--;
+ str++;
+ }
+ }
+ }
+
+ return (expect_bytes == 0);
+}
+
+// EOF
diff --git a/plugins/CryptoPP/src/utf8.h b/plugins/CryptoPP/src/utf8.h new file mode 100644 index 0000000000..5a9b3eaceb --- /dev/null +++ b/plugins/CryptoPP/src/utf8.h @@ -0,0 +1,9 @@ +#ifndef __UTF_8__
+#define __UTF_8__
+
+LPSTR __cdecl utf8encode(LPCWSTR str);
+LPWSTR __cdecl utf8decode(LPCSTR str);
+int __cdecl is_7bit_string(LPCSTR);
+int __cdecl is_utf8_string(LPCSTR);
+
+#endif
diff --git a/plugins/CryptoPP/src/version.h b/plugins/CryptoPP/src/version.h new file mode 100644 index 0000000000..27cbf73c16 --- /dev/null +++ b/plugins/CryptoPP/src/version.h @@ -0,0 +1,16 @@ +#ifndef __VERSION_H_INCLUDED
+#define __VERSION_H_INCLUDED
+
+#define __MAJOR_VERSION 1
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 4
+#define __BUILD_NUM 4
+
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
+#define __STRINGIFY(x) #x
+#define __TOSTRING(x) __STRINGIFY(x)
+#define __VERSION_STRING __TOSTRING(__FILEVERSION_STRING_DOTS)
+#define __VERSION_DWORD ((__MAJOR_VERSION<<24) | (__MINOR_VERSION<<16) | (__RELEASE_NUM<<8) | __BUILD_NUM)
+
+#endif //__VERSION_H_INCLUDED
|