📄 modules.txt
字号:
modules.txtDescription of each module in sftpdScott McPeak, May 31 1999Updated: June 19, 2000--------------Library: extrasHas lots of self-contained library-like modules.Contains all the modules below, up to the 'smcrypto' library.Module: syserrModule for portably reporting errors that result from system calls.Module: breakerPlace to put a breakpoint; basically a debugging aid.Module: crcCompute a 32-bit CRC (cyclic redundancy check).Module: datablokStore an arbitrary-size block of binary data.Module: excBase classes for exceptions.Module: intutilsA few small utilities on top of Integer (integer.h).Module: missingA few random functions that sometimes aren't present, but I need them.Module: nonportGrab-bag of functions with portable interfaces but nonportableimplementations. Includes file access restrictions, etc.Module: strA string class.Module: warnModule for reporting warnings to the user. Not very well thought-outat the moment.--------------Library: smcrypto (SM's crypto)All cryptography functions for SafeTP. Includes some stuff from Wei Dai'scrypto++, plus some stuff I (SM) wrote.Contains all the modules below, up to 'sftp' library.Module: crypto/ialgebraWei Dai's "algebra" module, modified to eliminate use of templates.Has algebra functions, I guess.Module: securityProtocol primitives. SafeTP's protocol mechanisms are built asderived classes of those that appear here.Module: blokutilSome utilities for DataBlocks. Mostly these involve encoding and decodingvarious data types into and out of DataBlocks. (Kinda like a streamsinterface.)Module: gmp_siA big-integer class, wrapped around the GNU Multi-precision integerlibrary implementation. (Header is sint.h.)Module: transCryptographic primitives. The base class for several cryptographic operationsused by SafeTP appears here.Module: selgamal (Scott's ElGamal)My implementation of the El Gamal public-key cipher.Module: sdsa (Scott's DSA)My implemenetation of the DSA (Digital Signature Algorithm) public-keysignature algorithm.Module: shmac (Scott's HMAC)My implementation of HMAC (Hash Message Authentication Code).Module: ssha (Scott's SHA)Wei Dai's "sha" module, modified to eliminate use of templates.Module: crypto/{asn,cryptlib,des,dessp,integer,md5,misc,modes, nbtheory,queue,randpool,rng}Wei Dai's crypto++ modules we needed for SafeTP. They are largelyunchanged (maybe entirely unchanged) from his 2.3 release. I don'tknow what all of them do, but most have reasonably meaningfulnames. (E.g., des is DES (Data Encryption Standard) cipher.)--------------Library: sftpThis has all the modules that are common to sftpd (the server) andsftpc (the client). This is basically everything.Contains all the modules listed below.Module: hclFunctions needed to work with the Hummingbird Inetd on NT.Module: digtComputes the digest of a series of messages, for implementing theDIGT command.Module: sftpSmall grab-bag of stuff common to sftpd and sftpc.Module: base64Dan's Base-64 functions. Base-64 is an encoding for representing8-bit data in a 6-bit code.Module: base64tMy wrapper on Dan's stuff.Module: cryputilSome cryptographic utilities built on top of Wei Dai's crypto++.Module: entropyFor gathering user-generated entropy periodically.Module: filesrcFor reading a file as a StreamInputSource, which I use as thebasis for reading things one line at a time.Module: keydbDan's module for maintaining the database of known serverpublic keys.Module: keyutilsMore of Dan's key stuff.Module: globrandImplementation of a pseudo-random number generator that iscryptographically strong. Includes some additional measures toensure that even if an attacker sees most or all of the output, itis still insufficient to predict future output (it's unclear whetherthe PRNG on which it is based has this property).Module: linereadModule for reading something one line at a time. This is morecomplex than you might think...Module: memsrcStreamInputSource for reading from a memory buffer.Module: providerImplemented SecurityProviders, which function as high-levelprotocol managers.Module: replyStores an FTP reply.Module: requestStores an FTP request.Module: sec_clrImplementation of X-CLEARTEXT and X-CLEARTEXT2 protocols. Theseare for debugging purposes only, and are NOT secure.Module: sec_de3sImplementation of X-SAFETP1 protocol. This is the protocol usedin SafeTP, over the wire.Module: sftpverJust gives the sftpd version number string.Module: socksrcStreamInputSource from a communications socket.Module: sockutilBunch of useful stuff I built on top of sockets. Includes thingslike automatically throwing exceptions when certain calls fail.--------------Miscellanous headers (no associated .cpp file)integer.h - just #includes sint.h; for backward compatibility with crypto++socketd.h - declaration of SOCKET typestlsubst.h - all the STL that crypto++ needs, so real STL need not be dealt withtest.h - some macros, etc., to facilitate writing test codetyp.h - declarations of types, and a few utility macrosxassert.h - assert() replacement that throws an exception instead of aborting--------------Executable: sftpdThis is the server (daemon) for SafeTP. It acts as a proxy, doingencryption and decryption while forwarding traffic between thenormal FTP daemon (ftpd) and the client.Main file: sftpd.cpp--------------Executable: sftpcThis is the unix client for SafeTP. It is a stand-alone programthat works in some respects like the normal FTP client, but (fornow) has a hairier interface. Note that the client we expectpeople to actually use is the 95/8/NT client, written by Dan asa proxy client, available from: http://safetp.cs.berkeley.edu--------------Notes on reading this code.In general, it is possible to read code either bottom-up or top-down.In fact, I usually do a mix of both. So I will give pointers forboth methods. As always, read the header files (*.h) before thecode files (*.cpp).Bottom-up:Start with the 'extras' library. The most interesting module is'datablok', followed perhaps by 'str'. 'nonport' is fun if youlike seeing how unix and nt differ.Then move to the 'smcrypto' library. 'blokutil' shows how toencode various things, which are encodings specified by theSafeTP protocol, X-SAFETP1. 'trans' and 'security' are thefoundations of the cryptography and security modules, respectively.The rest are not of interest, unless you want to see how somecrypto is implemented. In that case, 'selgamal' and 'sdsa' havethe most readable code, and are implementations of two public-keyalgorithms. (The Integer class they use is defined in'crypto/integer'.)Next, look at the 'sftp' library. 'request' and 'reply' showhow to store and parse FTP protocol sequences. 'lineread' and'{mem,file,sock}src' show a nice way to break things up into lineswithout knowing exactly which medium they come from (and withoutreading beyond the CRLF, since that would block). 'sec_de3s' isthe X-SAFETP1 protocol itself. It's long and hard to read; itmay be best to start with just the .h file and ignore the .cppfor now.Lastly, examine the executables themselves. 'sftpd' is betterstructured and more fully-functioned than 'sftpc', at least fornow. sftpd is also long, but should be mostly straightforward.Top-down:Basicaly the reverse of what I just said. :)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -