# CRYPTLIB 0.99 API mapping The supplied `cryptl99.zip` removes the remaining uncertainty about the CRYPTLIB calls. The executable's call shapes, local structure offsets and the source in `crypt.h`/`crypt.c` all agree. | Operation | CRYPTLIB 0.99 function | des.exe target | undes.exe target | |---|---|---:|---:| | Initialise library | `initLibrary()` | `00B3:0738` | `00B7:072A` | | End library | `endLibrary()` | `00B3:0746` | `00B7:0738` | | Query algorithm/mode | `queryAlgoModeInformation()` | `00B3:0566` | `00B7:0558` | | Query context | `queryContextInformation()` | `00B3:06EC` | `00B7:06DE` | | Initialise context | `initCryptContext()` | `00B3:0756` | `00B7:0748` | | Destroy context | `destroyCryptContext()` | `00B3:0940` | `00B7:0932` | | Load key | `loadCryptContext()` | `00B3:09C5` | `00B7:09B7` | | Retrieve IV | `retrieveIV()` | `00B3:0BA9` | — | | Load IV | `loadIV()` | — | `00B7:0A90` | | Encrypt | `encryptBuffer()` | `00B3:0C1E` | — | | Decrypt | `decryptBuffer()` | — | `00B7:0CEC` | ## Algorithm values Both mains store the integer value `3` for the algorithm and `3` for the mode. In the supplied `crypt.h` these are: ```c CRYPT_ALGO_3DES == 3 CRYPT_MODE_CBC == 3 ``` So DES/UNDES V1.1.0 uses **two-key triple DES in CBC mode**. The `CRYPT_QUERY_INFO` offsets used by the machine code also match the supplied header in the 16-bit large memory model. The program reads: - `keySize` = 14 bytes (112 bits) - `ivSize` = 4 bytes (32 bits) Those are exactly the recommended values in the CRYPTLIB 0.99 `3DES-CBC` capability entry.