├── .github └── workflows │ └── release-cli.yml ├── .gitignore ├── .gitmodules ├── C ├── Makefile ├── README.md ├── SSL │ ├── include │ │ ├── openssl │ │ │ ├── Makefile │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── aes.h │ │ │ ├── asn1.h │ │ │ ├── asn1t.h │ │ │ ├── bio.h │ │ │ ├── blowfish.h │ │ │ ├── bn.h │ │ │ ├── buffer.h │ │ │ ├── camellia.h │ │ │ ├── cast.h │ │ │ ├── chacha.h │ │ │ ├── cmac.h │ │ │ ├── cms.h │ │ │ ├── comp.h │ │ │ ├── conf.h │ │ │ ├── conf_api.h │ │ │ ├── crypto.h │ │ │ ├── ct.h │ │ │ ├── cterr.h │ │ │ ├── curve25519.h │ │ │ ├── des.h │ │ │ ├── dh.h │ │ │ ├── dsa.h │ │ │ ├── dso.h │ │ │ ├── dtls1.h │ │ │ ├── ec.h │ │ │ ├── ecdh.h │ │ │ ├── ecdsa.h │ │ │ ├── engine.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── gost.h │ │ │ ├── hkdf.h │ │ │ ├── hmac.h │ │ │ ├── idea.h │ │ │ ├── lhash.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ ├── modes.h │ │ │ ├── obj_mac.h │ │ │ ├── objects.h │ │ │ ├── ocsp.h │ │ │ ├── opensslconf.h │ │ │ ├── opensslfeatures.h │ │ │ ├── opensslv.h │ │ │ ├── ossl_typ.h │ │ │ ├── pem.h │ │ │ ├── pem2.h │ │ │ ├── pkcs12.h │ │ │ ├── pkcs7.h │ │ │ ├── poly1305.h │ │ │ ├── rand.h │ │ │ ├── rc2.h │ │ │ ├── rc4.h │ │ │ ├── ripemd.h │ │ │ ├── rsa.h │ │ │ ├── safestack.h │ │ │ ├── sha.h │ │ │ ├── sm3.h │ │ │ ├── sm4.h │ │ │ ├── srtp.h │ │ │ ├── ssl.h │ │ │ ├── ssl2.h │ │ │ ├── ssl23.h │ │ │ ├── ssl3.h │ │ │ ├── stack.h │ │ │ ├── tls1.h │ │ │ ├── ts.h │ │ │ ├── txt_db.h │ │ │ ├── ui.h │ │ │ ├── ui_compat.h │ │ │ ├── whrlpool.h │ │ │ ├── x509.h │ │ │ ├── x509_verify.h │ │ │ ├── x509_vfy.h │ │ │ └── x509v3.h │ │ ├── pqueue.h │ │ └── tls.h │ ├── libressl.sh │ ├── libressl.txt │ ├── linux_64bit │ │ └── libtls.a │ └── macos_fat │ │ └── libtls.a ├── apple │ ├── Makefile │ ├── README.md │ ├── build-apple.sh │ └── libressl.sh ├── cli │ ├── linenoise.c │ ├── linenoise.h │ ├── main.c │ └── sqlitecloud-cli.xcodeproj │ │ └── project.pbxproj ├── lz4.c ├── lz4.h ├── sqcloud.c ├── sqcloud.h └── sqcloud_private.h ├── PROTOCOL.md └── README.md /.github/workflows/release-cli.yml: -------------------------------------------------------------------------------- 1 | on: 2 | release: 3 | types: 4 | - published 5 | 6 | name: Upload C CLI Release Asset 7 | 8 | jobs: 9 | release-c-cli: 10 | name: Upload Release C CLI 11 | if: github.event_name == 'release' && startsWith(github.event.release.name, 'cli-') 12 | strategy: 13 | matrix: 14 | os: [ubuntu-latest] # windows-latest 15 | runs-on: ${{ matrix.os }} 16 | env: 17 | OSNAME: ${{matrix.os == 'ubuntu-latest' && 'linux' || matrix.os == 'windows-latest' && 'windows' || 'macos' }} 18 | 19 | steps: 20 | - name: Checkout code 21 | uses: actions/checkout@v3 22 | 23 | - name: Set env var 24 | run: echo "ZIPFILE=sqlitecloud-c-${{ github.event.release.name }}-${{ env.OSNAME }}.zip" >> $GITHUB_ENV 25 | 26 | - name: Build CLI 27 | run: | 28 | cd C 29 | make TLS_STATIC=1 cli 30 | zip ${{ env.ZIPFILE }} sqlitecloud-cli 31 | 32 | - name: Get release 33 | id: release 34 | uses: bruceadams/get-release@v1.2.3 35 | if: runner.os != 'macOS' 36 | env: 37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 38 | 39 | - name: Upload Release Asset 40 | id: upload-release-asset 41 | uses: actions/upload-release-asset@v1 42 | if: runner.os != 'macOS' 43 | env: 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 45 | with: 46 | upload_url: ${{ steps.release.outputs.upload_url }} 47 | asset_path: ./C/${{ env.ZIPFILE }} 48 | asset_name: ${{ env.ZIPFILE }} 49 | asset_content_type: application/zip 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | C/cli/sqlitecloud-cli.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist 2 | C/cli/sqlitecloud-cli.xcodeproj/xcuserdata/marco.xcuserdatad/xcschemes/xcschememanagement.plist 3 | C/sqlitecloud-cli 4 | bin 5 | pkg 6 | *.db 7 | .DS_Store 8 | .vscode 9 | *.tmproj 10 | example-session.txt 11 | *.o 12 | *.a 13 | Arbeitszeiten.txt 14 | github.com 15 | golang.org 16 | honnef.co 17 | mvdan.cc 18 | *.xcworkspacedata 19 | *.xcuserstate 20 | *.xcscheme 21 | *.xcexplist 22 | *.xcbkptlist 23 | native*.go 24 | *.out 25 | 26 | GO/src/gopkg.in/ini.v1/ 27 | GO/src/sqliteweb/dashboard/.nova/Configuration.json 28 | *.plist 29 | *.plist 30 | C/test/test.xcodeproj/xcuserdata/marco.xcuserdatad/xcschemes/xcschememanagement.plist 31 | 32 | C/apple/libressl-* 33 | C/apple/build/ 34 | C/apple/fat/ 35 | C/apple/output/ 36 | 37 | # dependencies 38 | JS/node_modules 39 | JS/**/node_modules 40 | JS/**/**/node_modules 41 | NODEJS/node_modules 42 | NODEJS/**/node_modules 43 | NODEJS/**/**/node_modules 44 | EDGE/node_modules 45 | EDGE/**/node_modules 46 | EDGE/**/**/node_modules 47 | 48 | 49 | # production 50 | JS/public 51 | JS/**/public 52 | JS/**/**/public 53 | 54 | #env 55 | JS/.env 56 | JS/**/.env 57 | JS/**/**/.env 58 | 59 | #vercel 60 | JS/.vercel 61 | 62 | # JS local example 63 | JS/example/local-sqlite-cloud-chat 64 | 65 | # NODEJS local example 66 | NODEJS/example 67 | examples/with-typescript-nextjs/.env 68 | C/apple/sqlitecloud-cli 69 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "sqlitecloud-js"] 2 | path = sqlitecloud-js 3 | url = https://github.com/sqlitecloud/sqlitecloud-js 4 | [submodule "sqlitecloud-py"] 5 | path = sqlitecloud-py 6 | url = https://github.com/sqlitecloud/sqlitecloud-py 7 | [submodule "sqlitecloud-php"] 8 | path = sqlitecloud-php 9 | url = https://github.com/sqlitecloud/sqlitecloud-php 10 | [submodule "sqlitecloud-go"] 11 | path = sqlitecloud-go 12 | url = https://github.com/sqlitecloud/sqlitecloud-go 13 | -------------------------------------------------------------------------------- /C/Makefile: -------------------------------------------------------------------------------- 1 | AR := ar 2 | CC := gcc 3 | INCLUDES := -I. -Icli 4 | OPTIONS := -Wno-shift-negative-value -Os -fPIC 5 | 6 | 7 | ifeq ($(OS),Windows_NT) 8 | # Windows 9 | else 10 | UNAME_S := $(shell uname -s) 11 | ifeq ($(UNAME_S),Darwin) 12 | # MacOS 13 | LDFLAGS = -lpthread -ltls 14 | ifeq ($(TLS_STATIC), 1) 15 | LIBFLAGS = -L./SSL/macos_fat 16 | else 17 | LIBRESSLDIR ?= /opt/homebrew/opt/libressl/lib/ 18 | LIBFLAGS = -L$(LIBRESSLDIR) 19 | endif 20 | else 21 | # Linux 22 | LDFLAGS = -lpthread -ltls 23 | ifeq ($(TLS_STATIC), 1) 24 | LIBFLAGS = -L./SSL/linux_64bit 25 | else 26 | LIBRESSLDIR ?= /usr/local/lib/ 27 | # LIBRESSLDIR ?= /usr/local/libressl/lib/ 28 | LIBFLAGS = -L$(LIBRESSLDIR) -Wl,-rpath=$(LIBRESSLDIR) 29 | endif 30 | endif 31 | endif 32 | 33 | all: libsqcloud.a 34 | 35 | lz4.o: lz4.c lz4.h 36 | $(CC) $(OPTIONS) $(INCLUDES) lz4.c -c -o lz4.o 37 | 38 | sqcloud.o: sqcloud.c sqcloud.h 39 | $(CC) $(OPTIONS) $(INCLUDES) sqcloud.c -c -o sqcloud.o 40 | 41 | libsqcloud.a: lz4.o sqcloud.o 42 | $(AR) rcs libsqcloud.a *.o 43 | 44 | libsqcloud.so: lz4.o sqcloud.o 45 | $(CC) -fPIC -shared *.o -o libsqcloud.so ${LIBFLAGS} ${LDFLAGS} 46 | 47 | libsqcloud.dylib: lz4.o sqcloud.o 48 | $(CC) -dynamiclib -install_name -flat_namespace *.o -o libsqcloud.dylib 49 | 50 | cli: sqlitecloud-cli 51 | 52 | sqlitecloud-cli: libsqcloud.a cli/linenoise.c cli/linenoise.h cli/main.c 53 | $(CC) $(OPTIONS) $(INCLUDES) cli/*.c libsqcloud.a -o sqlitecloud-cli ${LIBFLAGS} ${LDFLAGS} 54 | 55 | clean: 56 | rm -rf *.o *.a *.so *.dylib sqlitecloud-cli 57 | 58 | test: cli 59 | ./sqlitecloud-cli -h localhost 60 | -------------------------------------------------------------------------------- /C/README.md: -------------------------------------------------------------------------------- 1 | # C SDK 2 | 3 | SQCloud is the C application programmer's interface to SQLite Cloud. SQCloud is a set of library functions that allow client programs to pass queries and SQL commands to the SQLite Cloud backend server and to receive the results of these queries. In addition to the standard SQLite statements, several other [commands](https://docs.sqlitecloud.io/docs/commands) are supported. 4 | 5 | The following files are required when compiling a C application: 6 | 7 | - sqcloud.c/.h 8 | - lz4.c/.h 9 | - libtls.a (for static linking) or libtls.so/.dylib/.dll (for dynamic linking) 10 | 11 | The header file `sqcloud.h` must be included in your C application. 12 | 13 | All the communications between the client and the server are encrypted and so, you are required to link the LibreSSL (libtls) library with your client. 14 | 15 | ### Install LibreSSL 16 | 17 | ##### Linux: 18 | 19 | - download the latest portable source from [www.libressl.org](https://www.libressl.org/) 20 | 21 | - extract the tarball and change the directory to the libressl dir 22 | 23 | - compile and install LibreSSL. By default, the install script will install LibreSSL to the `/usr/local/` folder. In order to avoid issue with other SSL libraries installed on the system, you can specify a different install directory, for example `/usr/local/libressl`, with the following command: 24 | 25 | ``` 26 | ./configure --prefix=/usr/local/libressl --with-openssldir=/usr/local/libressl && make && make install 27 | ``` 28 | 29 | ##### macOS: 30 | 31 | ``` 32 | brew install libressl 33 | ``` 34 | 35 | 36 | 37 | ### Use the C SDK in your project 38 | 39 | Prerequisites: 40 | 41 | - [Install LibreSSL](#install-libressl) 42 | 43 | Use SQCloud: 44 | 45 | - Include the header file `sqcloud.h` 46 | 47 | - Compile `sqcloud.c ` and `lz4.c`. Examples from the Makefile: 48 | 49 | ``` 50 | lz4.o: lz4.c lz4.h 51 | $(CC) $(OPTIONS) $(INCLUDES) lz4.c -c -o lz4.o 52 | 53 | sqcloud.o: sqcloud.c sqcloud.h 54 | $(CC) $(OPTIONS) $(INCLUDES) sqcloud.c -c -o sqcloud.o 55 | 56 | libsqcloud.a: lz4.o sqcloud.o 57 | $(AR) rcs libsqcloud.a *.o 58 | ``` 59 | 60 | - Link with the compiled sources 61 | 62 | - Link with the libtls shared library using the following gcc option flags: 63 | 64 | - Add the libressl dir to the list of directories to be searched for: -L. Examples: 65 | 66 | linux: `-L/usr/local/libressl/lib/` 67 | 68 | macOS: `-L/opt/homebrew/opt/libressl/lib` 69 | 70 | - make the library available at runtime with the environment variable LD_LIBRARY_PATH or rpath. Example: `-Wl,-rpath=/usr/local/libressl/lib/` 71 | 72 | - link the shared library: `-ltls` 73 | 74 | Example from the Makefile: 75 | 76 | ``` 77 | CC := gcc 78 | INCLUDES := -I. -Icli 79 | OPTIONS := -Wno-macro-redefined -Wno-shift-negative-value -Os 80 | LDFLAGS = -ltls 81 | LIBFLAGS = -L/usr/local/libressl/lib/ -Wl,-rpath=/usr/local/libressl/lib/ 82 | ... 83 | cli: libsqcloud.a cli/linenoise.c cli/linenoise.h cli/main.c 84 | $(CC) $(OPTIONS) $(INCLUDES) cli/*.c libsqcloud.a -o sqlitecloud-cli ${LIBFLAGS} ${LDFLAGS} 85 | ``` 86 | 87 | 88 | 89 | # SQLite Cloud CLI 90 | 91 | The command-line interface is a text-based user interface to interact with a SQLite Cloud server. 92 | 93 | Prerequisites: 94 | 95 | - [Install LibreSSL](#install-libressl) 96 | 97 | Build: 98 | 99 | ``` 100 | make cli 101 | ``` 102 | 103 | Connect to a SQLite Cloud server: 104 | 105 | ``` 106 | ./sqlitecloud-cli -h .sqlite.cloud -p 8860 -n admin -m 107 | ``` 108 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/Makefile.am.common 2 | 3 | if !ENABLE_LIBTLS_ONLY 4 | opensslincludedir=$(includedir)/openssl 5 | 6 | opensslinclude_HEADERS = 7 | opensslinclude_HEADERS += aes.h 8 | opensslinclude_HEADERS += asn1.h 9 | opensslinclude_HEADERS += asn1t.h 10 | opensslinclude_HEADERS += bio.h 11 | opensslinclude_HEADERS += blowfish.h 12 | opensslinclude_HEADERS += bn.h 13 | opensslinclude_HEADERS += buffer.h 14 | opensslinclude_HEADERS += camellia.h 15 | opensslinclude_HEADERS += cast.h 16 | opensslinclude_HEADERS += chacha.h 17 | opensslinclude_HEADERS += cmac.h 18 | opensslinclude_HEADERS += cms.h 19 | opensslinclude_HEADERS += comp.h 20 | opensslinclude_HEADERS += conf.h 21 | opensslinclude_HEADERS += conf_api.h 22 | opensslinclude_HEADERS += crypto.h 23 | opensslinclude_HEADERS += ct.h 24 | opensslinclude_HEADERS += cterr.h 25 | opensslinclude_HEADERS += curve25519.h 26 | opensslinclude_HEADERS += des.h 27 | opensslinclude_HEADERS += dh.h 28 | opensslinclude_HEADERS += dsa.h 29 | opensslinclude_HEADERS += dso.h 30 | opensslinclude_HEADERS += dtls1.h 31 | opensslinclude_HEADERS += ec.h 32 | opensslinclude_HEADERS += ecdh.h 33 | opensslinclude_HEADERS += ecdsa.h 34 | opensslinclude_HEADERS += engine.h 35 | opensslinclude_HEADERS += err.h 36 | opensslinclude_HEADERS += evp.h 37 | opensslinclude_HEADERS += gost.h 38 | opensslinclude_HEADERS += hkdf.h 39 | opensslinclude_HEADERS += hmac.h 40 | opensslinclude_HEADERS += idea.h 41 | opensslinclude_HEADERS += lhash.h 42 | opensslinclude_HEADERS += md4.h 43 | opensslinclude_HEADERS += md5.h 44 | opensslinclude_HEADERS += modes.h 45 | opensslinclude_HEADERS += obj_mac.h 46 | opensslinclude_HEADERS += objects.h 47 | opensslinclude_HEADERS += ocsp.h 48 | opensslinclude_HEADERS += opensslconf.h 49 | opensslinclude_HEADERS += opensslfeatures.h 50 | opensslinclude_HEADERS += opensslv.h 51 | opensslinclude_HEADERS += ossl_typ.h 52 | opensslinclude_HEADERS += pem.h 53 | opensslinclude_HEADERS += pem2.h 54 | opensslinclude_HEADERS += pkcs12.h 55 | opensslinclude_HEADERS += pkcs7.h 56 | opensslinclude_HEADERS += poly1305.h 57 | opensslinclude_HEADERS += rand.h 58 | opensslinclude_HEADERS += rc2.h 59 | opensslinclude_HEADERS += rc4.h 60 | opensslinclude_HEADERS += ripemd.h 61 | opensslinclude_HEADERS += rsa.h 62 | opensslinclude_HEADERS += safestack.h 63 | opensslinclude_HEADERS += sha.h 64 | opensslinclude_HEADERS += sm3.h 65 | opensslinclude_HEADERS += sm4.h 66 | opensslinclude_HEADERS += srtp.h 67 | opensslinclude_HEADERS += ssl.h 68 | opensslinclude_HEADERS += ssl2.h 69 | opensslinclude_HEADERS += ssl23.h 70 | opensslinclude_HEADERS += ssl3.h 71 | opensslinclude_HEADERS += stack.h 72 | opensslinclude_HEADERS += tls1.h 73 | opensslinclude_HEADERS += ts.h 74 | opensslinclude_HEADERS += txt_db.h 75 | opensslinclude_HEADERS += ui.h 76 | opensslinclude_HEADERS += ui_compat.h 77 | opensslinclude_HEADERS += whrlpool.h 78 | opensslinclude_HEADERS += x509.h 79 | opensslinclude_HEADERS += x509_verify.h 80 | opensslinclude_HEADERS += x509_vfy.h 81 | opensslinclude_HEADERS += x509v3.h 82 | endif 83 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/aes.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: aes.h,v 1.14 2014/07/09 09:10:07 miod Exp $ */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #ifndef HEADER_AES_H 53 | #define HEADER_AES_H 54 | 55 | #include 56 | 57 | #ifdef OPENSSL_NO_AES 58 | #error AES is disabled. 59 | #endif 60 | 61 | #include 62 | 63 | #define AES_ENCRYPT 1 64 | #define AES_DECRYPT 0 65 | 66 | /* Because array size can't be a const in C, the following two are macros. 67 | Both sizes are in bytes. */ 68 | #define AES_MAXNR 14 69 | #define AES_BLOCK_SIZE 16 70 | 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | 75 | /* This should be a hidden type, but EVP requires that the size be known */ 76 | struct aes_key_st { 77 | unsigned int rd_key[4 *(AES_MAXNR + 1)]; 78 | int rounds; 79 | }; 80 | typedef struct aes_key_st AES_KEY; 81 | 82 | const char *AES_options(void); 83 | 84 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, 85 | AES_KEY *key); 86 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits, 87 | AES_KEY *key); 88 | 89 | void AES_encrypt(const unsigned char *in, unsigned char *out, 90 | const AES_KEY *key); 91 | void AES_decrypt(const unsigned char *in, unsigned char *out, 92 | const AES_KEY *key); 93 | 94 | void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, 95 | const AES_KEY *key, const int enc); 96 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 97 | size_t length, const AES_KEY *key, unsigned char *ivec, const int enc); 98 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, 99 | size_t length, const AES_KEY *key, unsigned char *ivec, int *num, 100 | const int enc); 101 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, 102 | size_t length, const AES_KEY *key, unsigned char *ivec, int *num, 103 | const int enc); 104 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, 105 | size_t length, const AES_KEY *key, unsigned char *ivec, int *num, 106 | const int enc); 107 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, 108 | size_t length, const AES_KEY *key, unsigned char *ivec, int *num); 109 | void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, 110 | size_t length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], 111 | unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num); 112 | /* NB: the IV is _two_ blocks long */ 113 | void AES_ige_encrypt(const unsigned char *in, unsigned char *out, 114 | size_t length, const AES_KEY *key, unsigned char *ivec, const int enc); 115 | 116 | int AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, 117 | const unsigned char *in, unsigned int inlen); 118 | int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, 119 | const unsigned char *in, unsigned int inlen); 120 | 121 | 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | 126 | #endif /* !HEADER_AES_H */ 127 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/blowfish.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: blowfish.h,v 1.15 2021/11/30 18:31:36 tb Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_BLOWFISH_H 60 | #define HEADER_BLOWFISH_H 61 | 62 | #include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | #ifdef OPENSSL_NO_BF 69 | #error BF is disabled. 70 | #endif 71 | 72 | #define BF_ENCRYPT 1 73 | #define BF_DECRYPT 0 74 | 75 | /* 76 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 77 | * ! BF_LONG has to be at least 32 bits wide. If it's wider, then ! 78 | * ! BF_LONG_LOG2 has to be defined along. ! 79 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 80 | */ 81 | 82 | #define BF_LONG unsigned int 83 | 84 | #define BF_ROUNDS 16 85 | #define BF_BLOCK 8 86 | 87 | typedef struct bf_key_st { 88 | BF_LONG P[BF_ROUNDS+2]; 89 | BF_LONG S[4*256]; 90 | } BF_KEY; 91 | 92 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); 93 | 94 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); 95 | void BF_decrypt(BF_LONG *data,const BF_KEY *key); 96 | 97 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, 98 | const BF_KEY *key, int enc); 99 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 100 | const BF_KEY *schedule, unsigned char *ivec, int enc); 101 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, 102 | const BF_KEY *schedule, unsigned char *ivec, int *num, int enc); 103 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, 104 | const BF_KEY *schedule, unsigned char *ivec, int *num); 105 | const char *BF_options(void); 106 | 107 | #ifdef __cplusplus 108 | } 109 | #endif 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/buffer.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: buffer.h,v 1.15 2015/06/24 10:05:14 jsing Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_BUFFER_H 60 | #define HEADER_BUFFER_H 61 | #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__OpenBSD__) 62 | #define __bounded__(x, y, z) 63 | #endif 64 | 65 | #include 66 | 67 | #ifdef __cplusplus 68 | extern "C" { 69 | #endif 70 | 71 | #include 72 | #include 73 | 74 | /* Already declared in ossl_typ.h */ 75 | /* typedef struct buf_mem_st BUF_MEM; */ 76 | 77 | struct buf_mem_st { 78 | size_t length; /* current number of bytes */ 79 | char *data; 80 | size_t max; /* size of buffer */ 81 | }; 82 | 83 | BUF_MEM *BUF_MEM_new(void); 84 | void BUF_MEM_free(BUF_MEM *a); 85 | int BUF_MEM_grow(BUF_MEM *str, size_t len); 86 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); 87 | 88 | #ifndef LIBRESSL_INTERNAL 89 | char * BUF_strdup(const char *str); 90 | char * BUF_strndup(const char *str, size_t siz); 91 | void * BUF_memdup(const void *data, size_t siz); 92 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); 93 | 94 | /* safe string functions */ 95 | size_t BUF_strlcpy(char *dst, const char *src, size_t siz) 96 | __attribute__ ((__bounded__(__string__,1,3))); 97 | size_t BUF_strlcat(char *dst, const char *src, size_t siz) 98 | __attribute__ ((__bounded__(__string__,1,3))); 99 | #endif 100 | 101 | /* BEGIN ERROR CODES */ 102 | /* The following lines are auto generated by the script mkerr.pl. Any changes 103 | * made after this point may be overwritten when the script is next run. 104 | */ 105 | void ERR_load_BUF_strings(void); 106 | 107 | /* Error codes for the BUF functions. */ 108 | 109 | /* Function codes. */ 110 | #define BUF_F_BUF_MEMDUP 103 111 | #define BUF_F_BUF_MEM_GROW 100 112 | #define BUF_F_BUF_MEM_GROW_CLEAN 105 113 | #define BUF_F_BUF_MEM_NEW 101 114 | #define BUF_F_BUF_STRDUP 102 115 | #define BUF_F_BUF_STRNDUP 104 116 | 117 | /* Reason codes. */ 118 | 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | #endif 123 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/camellia.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: camellia.h,v 1.5 2014/11/13 20:01:58 miod Exp $ */ 2 | /* ==================================================================== 3 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #ifndef HEADER_CAMELLIA_H 53 | #define HEADER_CAMELLIA_H 54 | 55 | #include 56 | 57 | #ifdef OPENSSL_NO_CAMELLIA 58 | #error CAMELLIA is disabled. 59 | #endif 60 | 61 | #include 62 | 63 | #define CAMELLIA_ENCRYPT 1 64 | #define CAMELLIA_DECRYPT 0 65 | 66 | /* Because array size can't be a const in C, the following two are macros. 67 | Both sizes are in bytes. */ 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | /* This should be a hidden type, but EVP requires that the size be known */ 74 | 75 | #define CAMELLIA_BLOCK_SIZE 16 76 | #define CAMELLIA_TABLE_BYTE_LEN 272 77 | #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) 78 | 79 | typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match with WORD */ 80 | 81 | struct camellia_key_st { 82 | union { 83 | double d; /* ensures 64-bit align */ 84 | KEY_TABLE_TYPE rd_key; 85 | } u; 86 | int grand_rounds; 87 | }; 88 | typedef struct camellia_key_st CAMELLIA_KEY; 89 | 90 | int Camellia_set_key(const unsigned char *userKey, const int bits, 91 | CAMELLIA_KEY *key); 92 | 93 | void Camellia_encrypt(const unsigned char *in, unsigned char *out, 94 | const CAMELLIA_KEY *key); 95 | void Camellia_decrypt(const unsigned char *in, unsigned char *out, 96 | const CAMELLIA_KEY *key); 97 | 98 | void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, 99 | const CAMELLIA_KEY *key, const int enc); 100 | void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, 101 | size_t length, const CAMELLIA_KEY *key, 102 | unsigned char *ivec, const int enc); 103 | void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, 104 | size_t length, const CAMELLIA_KEY *key, 105 | unsigned char *ivec, int *num, const int enc); 106 | void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, 107 | size_t length, const CAMELLIA_KEY *key, 108 | unsigned char *ivec, int *num, const int enc); 109 | void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, 110 | size_t length, const CAMELLIA_KEY *key, 111 | unsigned char *ivec, int *num, const int enc); 112 | void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, 113 | size_t length, const CAMELLIA_KEY *key, 114 | unsigned char *ivec, int *num); 115 | void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, 116 | size_t length, const CAMELLIA_KEY *key, 117 | unsigned char ivec[CAMELLIA_BLOCK_SIZE], 118 | unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], 119 | unsigned int *num); 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif /* !HEADER_Camellia_H */ 126 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/cast.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: cast.h,v 1.12 2014/07/10 22:45:56 jsing Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_CAST_H 60 | #define HEADER_CAST_H 61 | 62 | #include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | #ifdef OPENSSL_NO_CAST 69 | #error CAST is disabled. 70 | #endif 71 | 72 | #define CAST_ENCRYPT 1 73 | #define CAST_DECRYPT 0 74 | 75 | #define CAST_LONG unsigned int 76 | 77 | #define CAST_BLOCK 8 78 | #define CAST_KEY_LENGTH 16 79 | 80 | typedef struct cast_key_st 81 | { 82 | CAST_LONG data[32]; 83 | int short_key; /* Use reduced rounds for short key */ 84 | } CAST_KEY; 85 | 86 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); 87 | void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAST_KEY *key, 88 | int enc); 89 | void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); 90 | void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); 91 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 92 | const CAST_KEY *ks, unsigned char *iv, int enc); 93 | void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, 94 | long length, const CAST_KEY *schedule, unsigned char *ivec, 95 | int *num, int enc); 96 | void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, 97 | long length, const CAST_KEY *schedule, unsigned char *ivec, 98 | int *num); 99 | 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/chacha.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: chacha.h,v 1.8 2019/01/22 00:59:21 dlg Exp $ */ 2 | /* 3 | * Copyright (c) 2014 Joel Sing 4 | * 5 | * Permission to use, copy, modify, and distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | #ifndef HEADER_CHACHA_H 19 | #define HEADER_CHACHA_H 20 | 21 | #include 22 | 23 | #if defined(OPENSSL_NO_CHACHA) 24 | #error ChaCha is disabled. 25 | #endif 26 | 27 | #include 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct { 35 | unsigned int input[16]; 36 | unsigned char ks[64]; 37 | unsigned char unused; 38 | } ChaCha_ctx; 39 | 40 | void ChaCha_set_key(ChaCha_ctx *ctx, const unsigned char *key, 41 | unsigned int keybits); 42 | void ChaCha_set_iv(ChaCha_ctx *ctx, const unsigned char *iv, 43 | const unsigned char *counter); 44 | void ChaCha(ChaCha_ctx *ctx, unsigned char *out, const unsigned char *in, 45 | size_t len); 46 | 47 | void CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len, 48 | const unsigned char key[32], const unsigned char iv[8], uint64_t counter); 49 | void CRYPTO_xchacha_20(unsigned char *out, const unsigned char *in, size_t len, 50 | const unsigned char key[32], const unsigned char iv[24]); 51 | void CRYPTO_hchacha_20(unsigned char out[32], 52 | const unsigned char key[32], const unsigned char iv[16]); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* HEADER_CHACHA_H */ 59 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: cmac.h,v 1.3 2014/06/21 13:42:14 jsing Exp $ */ 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 | * project. 4 | */ 5 | /* ==================================================================== 6 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. All advertising materials mentioning features or use of this 21 | * software must display the following acknowledgment: 22 | * "This product includes software developed by the OpenSSL Project 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24 | * 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26 | * endorse or promote products derived from this software without 27 | * prior written permission. For written permission, please contact 28 | * licensing@OpenSSL.org. 29 | * 30 | * 5. Products derived from this software may not be called "OpenSSL" 31 | * nor may "OpenSSL" appear in their names without prior written 32 | * permission of the OpenSSL Project. 33 | * 34 | * 6. Redistributions of any form whatsoever must retain the following 35 | * acknowledgment: 36 | * "This product includes software developed by the OpenSSL Project 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * ==================================================================== 52 | */ 53 | 54 | 55 | #ifndef HEADER_CMAC_H 56 | #define HEADER_CMAC_H 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | #include 63 | 64 | /* Opaque */ 65 | typedef struct CMAC_CTX_st CMAC_CTX; 66 | 67 | CMAC_CTX *CMAC_CTX_new(void); 68 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 69 | void CMAC_CTX_free(CMAC_CTX *ctx); 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 72 | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 74 | const EVP_CIPHER *cipher, ENGINE *impl); 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 77 | int CMAC_resume(CMAC_CTX *ctx); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: comp.h,v 1.9 2022/01/14 08:21:12 tb Exp $ */ 2 | 3 | #ifndef HEADER_COMP_H 4 | #define HEADER_COMP_H 5 | 6 | #include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 13 | void COMP_CTX_free(COMP_CTX *ctx); 14 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 15 | unsigned char *in, int ilen); 16 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 17 | unsigned char *in, int ilen); 18 | COMP_METHOD *COMP_rle(void ); 19 | COMP_METHOD *COMP_zlib(void ); 20 | void COMP_zlib_cleanup(void); 21 | 22 | #ifdef HEADER_BIO_H 23 | #ifdef ZLIB 24 | BIO_METHOD *BIO_f_zlib(void); 25 | #endif 26 | #endif 27 | 28 | void ERR_load_COMP_strings(void); 29 | 30 | /* Error codes for the COMP functions. */ 31 | 32 | /* Function codes. */ 33 | #define COMP_F_BIO_ZLIB_FLUSH 99 34 | #define COMP_F_BIO_ZLIB_NEW 100 35 | #define COMP_F_BIO_ZLIB_READ 101 36 | #define COMP_F_BIO_ZLIB_WRITE 102 37 | 38 | /* Reason codes. */ 39 | #define COMP_R_ZLIB_DEFLATE_ERROR 99 40 | #define COMP_R_ZLIB_INFLATE_ERROR 100 41 | #define COMP_R_ZLIB_NOT_SUPPORTED 101 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif 47 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: conf_api.h,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_CONF_API_H 60 | #define HEADER_CONF_API_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* Up until OpenSSL 0.9.5a, this was new_section */ 70 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); 71 | /* Up until OpenSSL 0.9.5a, this was get_section */ 72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); 73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 75 | const char *section); 76 | 77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 78 | char *_CONF_get_string(const CONF *conf, const char *section, 79 | const char *name); 80 | long _CONF_get_number(const CONF *conf, const char *section, const char *name); 81 | 82 | int _CONF_new_data(CONF *conf); 83 | void _CONF_free_data(CONF *conf); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | #endif 89 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/cterr.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: cterr.h,v 1.5 2021/12/18 16:50:40 tb Exp $ */ 2 | /* ==================================================================== 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@OpenSSL.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes 57 | * made to it will be overwritten when the script next updates this file, 58 | * only reason strings will be preserved. 59 | */ 60 | 61 | #ifndef HEADER_CTERR_H 62 | # define HEADER_CTERR_H 63 | 64 | # include 65 | 66 | # ifndef OPENSSL_NO_CT 67 | 68 | #ifdef __cplusplus 69 | extern "C" 70 | #endif 71 | 72 | int ERR_load_CT_strings(void); 73 | 74 | /* 75 | * CT function codes. 76 | */ 77 | # define CT_F_CTLOG_NEW 117 78 | # define CT_F_CTLOG_NEW_FROM_BASE64 118 79 | # define CT_F_CTLOG_NEW_FROM_CONF 119 80 | # define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122 81 | # define CT_F_CTLOG_STORE_LOAD_FILE 123 82 | # define CT_F_CTLOG_STORE_LOAD_LOG 130 83 | # define CT_F_CTLOG_STORE_NEW 131 84 | # define CT_F_CT_BASE64_DECODE 124 85 | # define CT_F_CT_POLICY_EVAL_CTX_NEW 133 86 | # define CT_F_CT_V1_LOG_ID_FROM_PKEY 125 87 | # define CT_F_I2O_SCT 107 88 | # define CT_F_I2O_SCT_LIST 108 89 | # define CT_F_I2O_SCT_SIGNATURE 109 90 | # define CT_F_O2I_SCT 110 91 | # define CT_F_O2I_SCT_LIST 111 92 | # define CT_F_O2I_SCT_SIGNATURE 112 93 | # define CT_F_SCT_CTX_NEW 126 94 | # define CT_F_SCT_CTX_VERIFY 128 95 | # define CT_F_SCT_NEW 100 96 | # define CT_F_SCT_NEW_FROM_BASE64 127 97 | # define CT_F_SCT_SET0_LOG_ID 101 98 | # define CT_F_SCT_SET1_EXTENSIONS 114 99 | # define CT_F_SCT_SET1_LOG_ID 115 100 | # define CT_F_SCT_SET1_SIGNATURE 116 101 | # define CT_F_SCT_SET_LOG_ENTRY_TYPE 102 102 | # define CT_F_SCT_SET_SIGNATURE_NID 103 103 | # define CT_F_SCT_SET_VERSION 104 104 | 105 | /* 106 | * CT reason codes. 107 | */ 108 | # define CT_R_BASE64_DECODE_ERROR 108 109 | # define CT_R_INVALID_LOG_ID_LENGTH 100 110 | # define CT_R_LOG_CONF_INVALID 109 111 | # define CT_R_LOG_CONF_INVALID_KEY 110 112 | # define CT_R_LOG_CONF_MISSING_DESCRIPTION 111 113 | # define CT_R_LOG_CONF_MISSING_KEY 112 114 | # define CT_R_LOG_KEY_INVALID 113 115 | # define CT_R_SCT_FUTURE_TIMESTAMP 116 116 | # define CT_R_SCT_INVALID 104 117 | # define CT_R_SCT_INVALID_SIGNATURE 107 118 | # define CT_R_SCT_LIST_INVALID 105 119 | # define CT_R_SCT_LOG_ID_MISMATCH 114 120 | # define CT_R_SCT_NOT_SET 106 121 | # define CT_R_SCT_UNSUPPORTED_VERSION 115 122 | # define CT_R_UNRECOGNIZED_SIGNATURE_NID 101 123 | # define CT_R_UNSUPPORTED_ENTRY_TYPE 102 124 | # define CT_R_UNSUPPORTED_VERSION 103 125 | 126 | # endif 127 | #endif 128 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/curve25519.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: curve25519.h,v 1.3 2019/05/11 15:55:52 tb Exp $ */ 2 | /* 3 | * Copyright (c) 2015, Google Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 12 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 14 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 15 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | #ifndef HEADER_CURVE25519_H 19 | #define HEADER_CURVE25519_H 20 | 21 | #include 22 | 23 | #include 24 | 25 | #if defined(__cplusplus) 26 | extern "C" { 27 | #endif 28 | 29 | /* 30 | * Curve25519. 31 | * 32 | * Curve25519 is an elliptic curve. See https://tools.ietf.org/html/rfc7748. 33 | */ 34 | 35 | /* 36 | * X25519. 37 | * 38 | * X25519 is the Diffie-Hellman primitive built from curve25519. It is 39 | * sometimes referred to as curve25519, but X25519 is a more precise name. 40 | * See http://cr.yp.to/ecdh.html and https://tools.ietf.org/html/rfc7748. 41 | */ 42 | 43 | #define X25519_KEY_LENGTH 32 44 | 45 | /* 46 | * X25519_keypair sets |out_public_value| and |out_private_key| to a freshly 47 | * generated, public/private key pair. 48 | */ 49 | void X25519_keypair(uint8_t out_public_value[X25519_KEY_LENGTH], 50 | uint8_t out_private_key[X25519_KEY_LENGTH]); 51 | 52 | /* 53 | * X25519 writes a shared key to |out_shared_key| that is calculated from the 54 | * given private key and the peer's public value. It returns one on success and 55 | * zero on error. 56 | * 57 | * Don't use the shared key directly, rather use a KDF and also include the two 58 | * public values as inputs. 59 | */ 60 | int X25519(uint8_t out_shared_key[X25519_KEY_LENGTH], 61 | const uint8_t private_key[X25519_KEY_LENGTH], 62 | const uint8_t peers_public_value[X25519_KEY_LENGTH]); 63 | 64 | #if defined(__cplusplus) 65 | } /* extern C */ 66 | #endif 67 | 68 | #endif /* HEADER_CURVE25519_H */ 69 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/dtls1.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: dtls1.h,v 1.27 2021/05/16 13:56:30 jsing Exp $ */ 2 | /* 3 | * DTLS implementation written by Nagendra Modadugu 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_DTLS1_H 61 | #define HEADER_DTLS1_H 62 | 63 | #if defined(_WIN32) 64 | #include 65 | #else 66 | #include 67 | #endif 68 | 69 | #include 70 | #include 71 | #include 72 | 73 | #include 74 | #include 75 | 76 | #ifdef __cplusplus 77 | extern "C" { 78 | #endif 79 | 80 | #define DTLS1_VERSION 0xFEFF 81 | #define DTLS1_2_VERSION 0xFEFD 82 | #define DTLS1_VERSION_MAJOR 0xFE 83 | 84 | /* lengths of messages */ 85 | #define DTLS1_COOKIE_LENGTH 256 86 | 87 | #define DTLS1_RT_HEADER_LENGTH 13 88 | 89 | #define DTLS1_HM_HEADER_LENGTH 12 90 | 91 | #define DTLS1_HM_BAD_FRAGMENT -2 92 | #define DTLS1_HM_FRAGMENT_RETRY -3 93 | 94 | #define DTLS1_CCS_HEADER_LENGTH 1 95 | 96 | #define DTLS1_AL_HEADER_LENGTH 2 97 | 98 | /* Timeout multipliers (timeout slice is defined in apps/timeouts.h */ 99 | #define DTLS1_TMO_READ_COUNT 2 100 | #define DTLS1_TMO_WRITE_COUNT 2 101 | 102 | #define DTLS1_TMO_ALERT_COUNT 12 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | #endif 108 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: ecdh.h,v 1.5 2015/09/13 12:03:07 jsing Exp $ */ 2 | /* ==================================================================== 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 4 | * 5 | * The Elliptic Curve Public-Key Crypto Library (ECC Code) included 6 | * herein is developed by SUN MICROSYSTEMS, INC., and is contributed 7 | * to the OpenSSL project. 8 | * 9 | * The ECC Code is licensed pursuant to the OpenSSL open source 10 | * license provided below. 11 | * 12 | * The ECDH software is originally written by Douglas Stebila of 13 | * Sun Microsystems Laboratories. 14 | * 15 | */ 16 | /* ==================================================================== 17 | * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. 18 | * 19 | * Redistribution and use in source and binary forms, with or without 20 | * modification, are permitted provided that the following conditions 21 | * are met: 22 | * 23 | * 1. Redistributions of source code must retain the above copyright 24 | * notice, this list of conditions and the following disclaimer. 25 | * 26 | * 2. Redistributions in binary form must reproduce the above copyright 27 | * notice, this list of conditions and the following disclaimer in 28 | * the documentation and/or other materials provided with the 29 | * distribution. 30 | * 31 | * 3. All advertising materials mentioning features or use of this 32 | * software must display the following acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 35 | * 36 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 37 | * endorse or promote products derived from this software without 38 | * prior written permission. For written permission, please contact 39 | * licensing@OpenSSL.org. 40 | * 41 | * 5. Products derived from this software may not be called "OpenSSL" 42 | * nor may "OpenSSL" appear in their names without prior written 43 | * permission of the OpenSSL Project. 44 | * 45 | * 6. Redistributions of any form whatsoever must retain the following 46 | * acknowledgment: 47 | * "This product includes software developed by the OpenSSL Project 48 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 49 | * 50 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 51 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 53 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 54 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 56 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 57 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 59 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 61 | * OF THE POSSIBILITY OF SUCH DAMAGE. 62 | * ==================================================================== 63 | * 64 | * This product includes cryptographic software written by Eric Young 65 | * (eay@cryptsoft.com). This product includes software written by Tim 66 | * Hudson (tjh@cryptsoft.com). 67 | * 68 | */ 69 | #ifndef HEADER_ECDH_H 70 | #define HEADER_ECDH_H 71 | 72 | #include 73 | 74 | #ifdef OPENSSL_NO_ECDH 75 | #error ECDH is disabled. 76 | #endif 77 | 78 | #include 79 | #include 80 | #ifndef OPENSSL_NO_DEPRECATED 81 | #include 82 | #endif 83 | 84 | #ifdef __cplusplus 85 | extern "C" { 86 | #endif 87 | 88 | const ECDH_METHOD *ECDH_OpenSSL(void); 89 | 90 | void ECDH_set_default_method(const ECDH_METHOD *); 91 | const ECDH_METHOD *ECDH_get_default_method(void); 92 | int ECDH_set_method(EC_KEY *, const ECDH_METHOD *); 93 | 94 | int ECDH_size(const EC_KEY *ecdh); 95 | int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, 96 | EC_KEY *ecdh, 97 | void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)); 98 | 99 | int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new 100 | *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 101 | int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg); 102 | void *ECDH_get_ex_data(EC_KEY *d, int idx); 103 | 104 | 105 | /* BEGIN ERROR CODES */ 106 | /* The following lines are auto generated by the script mkerr.pl. Any changes 107 | * made after this point may be overwritten when the script is next run. 108 | */ 109 | void ERR_load_ECDH_strings(void); 110 | 111 | /* Error codes for the ECDH functions. */ 112 | 113 | /* Function codes. */ 114 | #define ECDH_F_ECDH_CHECK 102 115 | #define ECDH_F_ECDH_COMPUTE_KEY 100 116 | #define ECDH_F_ECDH_DATA_NEW_METHOD 101 117 | 118 | /* Reason codes. */ 119 | #define ECDH_R_KDF_FAILED 102 120 | #define ECDH_R_KEY_TRUNCATION 104 121 | #define ECDH_R_NON_FIPS_METHOD 103 122 | #define ECDH_R_NO_PRIVATE_VALUE 100 123 | #define ECDH_R_POINT_ARITHMETIC_FAILURE 101 124 | 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | #endif 129 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/hkdf.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: hkdf.h,v 1.2 2018/04/03 13:33:53 tb Exp $ */ 2 | /* Copyright (c) 2014, Google Inc. 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ 15 | 16 | #ifndef OPENSSL_HEADER_HKDF_H 17 | #define OPENSSL_HEADER_HKDF_H 18 | 19 | #include 20 | 21 | #if defined(__cplusplus) 22 | extern "C" { 23 | #endif 24 | 25 | /* 26 | * HKDF computes HKDF (as specified by RFC 5869) of initial keying 27 | * material |secret| with |salt| and |info| using |digest|, and 28 | * outputs |out_len| bytes to |out_key|. It returns one on success and 29 | * zero on error. 30 | * 31 | * HKDF is an Extract-and-Expand algorithm. It does not do any key 32 | * stretching, and as such, is not suited to be used alone to generate 33 | * a key from a password. 34 | */ 35 | 36 | int HKDF(uint8_t *out_key, size_t out_len, const struct env_md_st *digest, 37 | const uint8_t *secret, size_t secret_len, const uint8_t *salt, 38 | size_t salt_len, const uint8_t *info, size_t info_len); 39 | 40 | /* 41 | * HKDF_extract computes a HKDF PRK (as specified by RFC 5869) from 42 | * initial keying material |secret| and salt |salt| using |digest|, 43 | * and outputs |out_len| bytes to |out_key|. The maximum output size 44 | * is |EVP_MAX_MD_SIZE|. It returns one on success and zero on error. 45 | */ 46 | int HKDF_extract(uint8_t *out_key, size_t *out_len, 47 | const struct env_md_st *digest, const uint8_t *secret, 48 | size_t secret_len, const uint8_t *salt, size_t salt_len); 49 | 50 | /* 51 | * HKDF_expand computes a HKDF OKM (as specified by RFC 5869) of 52 | * length |out_len| from the PRK |prk| and info |info| using |digest|, 53 | * and outputs the result to |out_key|. It returns one on success and 54 | * zero on error. 55 | */ 56 | int HKDF_expand(uint8_t *out_key, size_t out_len, 57 | const EVP_MD *digest, const uint8_t *prk, size_t prk_len, 58 | const uint8_t *info, size_t info_len); 59 | 60 | 61 | #if defined(__cplusplus) 62 | } /* extern C */ 63 | #endif 64 | 65 | #endif /* OPENSSL_HEADER_HKDF_H */ 66 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/hmac.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: hmac.h,v 1.16 2022/01/14 08:06:03 tb Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | #ifndef HEADER_HMAC_H 59 | #define HEADER_HMAC_H 60 | 61 | #include 62 | 63 | #ifdef OPENSSL_NO_HMAC 64 | #error HMAC is disabled. 65 | #endif 66 | 67 | #include 68 | 69 | #define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ 70 | 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | 75 | #define HMAC_size(e) (EVP_MD_size(HMAC_CTX_get_md((e)))) 76 | 77 | HMAC_CTX *HMAC_CTX_new(void); 78 | void HMAC_CTX_free(HMAC_CTX *ctx); 79 | int HMAC_CTX_reset(HMAC_CTX *ctx); 80 | 81 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, 82 | const EVP_MD *md); /* deprecated */ 83 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, 84 | ENGINE *impl); 85 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); 86 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); 87 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, 88 | const unsigned char *d, size_t n, unsigned char *md, unsigned int *md_len); 89 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); 90 | 91 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); 92 | const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/idea.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: idea.h,v 1.10 2014/06/12 15:49:29 deraadt Exp $ */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_IDEA_H 60 | #define HEADER_IDEA_H 61 | 62 | #include /* IDEA_INT, OPENSSL_NO_IDEA */ 63 | 64 | #ifdef OPENSSL_NO_IDEA 65 | #error IDEA is disabled. 66 | #endif 67 | 68 | #define IDEA_ENCRYPT 1 69 | #define IDEA_DECRYPT 0 70 | 71 | #define IDEA_BLOCK 8 72 | #define IDEA_KEY_LENGTH 16 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | typedef struct idea_key_st 79 | { 80 | IDEA_INT data[9][6]; 81 | } IDEA_KEY_SCHEDULE; 82 | 83 | const char *idea_options(void); 84 | void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, 85 | IDEA_KEY_SCHEDULE *ks); 86 | void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); 87 | void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); 88 | void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, 89 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc); 90 | void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, 91 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, 92 | int *num,int enc); 93 | void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, 94 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num); 95 | void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/lhash.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: lhash.h,v 1.12 2014/06/12 15:49:29 deraadt Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | /* Header for dynamic hash table routines 60 | * Author - Eric Young 61 | */ 62 | 63 | #ifndef HEADER_LHASH_H 64 | #define HEADER_LHASH_H 65 | 66 | #include 67 | 68 | #include 69 | 70 | #ifndef OPENSSL_NO_BIO 71 | #include 72 | #endif 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | typedef struct lhash_node_st { 79 | void *data; 80 | struct lhash_node_st *next; 81 | #ifndef OPENSSL_NO_HASH_COMP 82 | unsigned long hash; 83 | #endif 84 | } LHASH_NODE; 85 | 86 | typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *); 87 | typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *); 88 | typedef void (*LHASH_DOALL_FN_TYPE)(void *); 89 | typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *); 90 | 91 | /* Macros for declaring and implementing type-safe wrappers for LHASH callbacks. 92 | * This way, callbacks can be provided to LHASH structures without function 93 | * pointer casting and the macro-defined callbacks provide per-variable casting 94 | * before deferring to the underlying type-specific callbacks. NB: It is 95 | * possible to place a "static" in front of both the DECLARE and IMPLEMENT 96 | * macros if the functions are strictly internal. */ 97 | 98 | /* First: "hash" functions */ 99 | #define DECLARE_LHASH_HASH_FN(name, o_type) \ 100 | unsigned long name##_LHASH_HASH(const void *); 101 | #define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ 102 | unsigned long name##_LHASH_HASH(const void *arg) { \ 103 | const o_type *a = arg; \ 104 | return name##_hash(a); } 105 | #define LHASH_HASH_FN(name) name##_LHASH_HASH 106 | 107 | /* Second: "compare" functions */ 108 | #define DECLARE_LHASH_COMP_FN(name, o_type) \ 109 | int name##_LHASH_COMP(const void *, const void *); 110 | #define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ 111 | int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ 112 | const o_type *a = arg1; \ 113 | const o_type *b = arg2; \ 114 | return name##_cmp(a,b); } 115 | #define LHASH_COMP_FN(name) name##_LHASH_COMP 116 | 117 | /* Third: "doall" functions */ 118 | #define DECLARE_LHASH_DOALL_FN(name, o_type) \ 119 | void name##_LHASH_DOALL(void *); 120 | #define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \ 121 | void name##_LHASH_DOALL(void *arg) { \ 122 | o_type *a = arg; \ 123 | name##_doall(a); } 124 | #define LHASH_DOALL_FN(name) name##_LHASH_DOALL 125 | 126 | /* Fourth: "doall_arg" functions */ 127 | #define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ 128 | void name##_LHASH_DOALL_ARG(void *, void *); 129 | #define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ 130 | void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ 131 | o_type *a = arg1; \ 132 | a_type *b = arg2; \ 133 | name##_doall_arg(a, b); } 134 | #define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG 135 | 136 | typedef struct lhash_st { 137 | LHASH_NODE **b; 138 | LHASH_COMP_FN_TYPE comp; 139 | LHASH_HASH_FN_TYPE hash; 140 | unsigned int num_nodes; 141 | unsigned int num_alloc_nodes; 142 | unsigned int p; 143 | unsigned int pmax; 144 | unsigned long up_load; /* load times 256 */ 145 | unsigned long down_load; /* load times 256 */ 146 | unsigned long num_items; 147 | 148 | unsigned long num_expands; 149 | unsigned long num_expand_reallocs; 150 | unsigned long num_contracts; 151 | unsigned long num_contract_reallocs; 152 | unsigned long num_hash_calls; 153 | unsigned long num_comp_calls; 154 | unsigned long num_insert; 155 | unsigned long num_replace; 156 | unsigned long num_delete; 157 | unsigned long num_no_delete; 158 | unsigned long num_retrieve; 159 | unsigned long num_retrieve_miss; 160 | unsigned long num_hash_comps; 161 | 162 | int error; 163 | } _LHASH; /* Do not use _LHASH directly, use LHASH_OF 164 | * and friends */ 165 | 166 | #define LH_LOAD_MULT 256 167 | 168 | /* Indicates a malloc() error in the last call, this is only bad 169 | * in lh_insert(). */ 170 | #define lh_error(lh) ((lh)->error) 171 | 172 | _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); 173 | void lh_free(_LHASH *lh); 174 | void *lh_insert(_LHASH *lh, void *data); 175 | void *lh_delete(_LHASH *lh, const void *data); 176 | void *lh_retrieve(_LHASH *lh, const void *data); 177 | void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func); 178 | void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); 179 | unsigned long lh_strhash(const char *c); 180 | unsigned long lh_num_items(const _LHASH *lh); 181 | 182 | void lh_stats(const _LHASH *lh, FILE *out); 183 | void lh_node_stats(const _LHASH *lh, FILE *out); 184 | void lh_node_usage_stats(const _LHASH *lh, FILE *out); 185 | 186 | #ifndef OPENSSL_NO_BIO 187 | void lh_stats_bio(const _LHASH *lh, BIO *out); 188 | void lh_node_stats_bio(const _LHASH *lh, BIO *out); 189 | void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out); 190 | #endif 191 | 192 | /* Type checking... */ 193 | 194 | #define LHASH_OF(type) struct lhash_st_##type 195 | 196 | #define DECLARE_LHASH_OF(type) LHASH_OF(type) { int dummy; } 197 | 198 | #define CHECKED_LHASH_OF(type,lh) \ 199 | ((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh)) 200 | 201 | /* Define wrapper functions. */ 202 | #define LHM_lh_new(type, name) \ 203 | ((LHASH_OF(type) *)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name))) 204 | #define LHM_lh_error(type, lh) \ 205 | lh_error(CHECKED_LHASH_OF(type,lh)) 206 | #define LHM_lh_insert(type, lh, inst) \ 207 | ((type *)lh_insert(CHECKED_LHASH_OF(type, lh), \ 208 | CHECKED_PTR_OF(type, inst))) 209 | #define LHM_lh_retrieve(type, lh, inst) \ 210 | ((type *)lh_retrieve(CHECKED_LHASH_OF(type, lh), \ 211 | CHECKED_PTR_OF(type, inst))) 212 | #define LHM_lh_delete(type, lh, inst) \ 213 | ((type *)lh_delete(CHECKED_LHASH_OF(type, lh), \ 214 | CHECKED_PTR_OF(type, inst))) 215 | #define LHM_lh_doall(type, lh,fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn) 216 | #define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \ 217 | lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg)) 218 | #define LHM_lh_num_items(type, lh) lh_num_items(CHECKED_LHASH_OF(type, lh)) 219 | #define LHM_lh_down_load(type, lh) (CHECKED_LHASH_OF(type, lh)->down_load) 220 | #define LHM_lh_node_stats_bio(type, lh, out) \ 221 | lh_node_stats_bio(CHECKED_LHASH_OF(type, lh), out) 222 | #define LHM_lh_node_usage_stats_bio(type, lh, out) \ 223 | lh_node_usage_stats_bio(CHECKED_LHASH_OF(type, lh), out) 224 | #define LHM_lh_stats_bio(type, lh, out) \ 225 | lh_stats_bio(CHECKED_LHASH_OF(type, lh), out) 226 | #define LHM_lh_free(type, lh) lh_free(CHECKED_LHASH_OF(type, lh)) 227 | 228 | DECLARE_LHASH_OF(OPENSSL_STRING); 229 | DECLARE_LHASH_OF(OPENSSL_CSTRING); 230 | 231 | #ifdef __cplusplus 232 | } 233 | #endif 234 | 235 | #endif 236 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/md4.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: md4.h,v 1.16 2015/09/14 01:45:03 doug Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #include 60 | 61 | #ifndef HEADER_MD4_H 62 | #define HEADER_MD4_H 63 | 64 | #include 65 | 66 | #ifdef __cplusplus 67 | extern "C" { 68 | #endif 69 | 70 | #ifdef OPENSSL_NO_MD4 71 | #error MD4 is disabled. 72 | #endif 73 | 74 | /* 75 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 76 | * ! MD4_LONG has to be at least 32 bits wide. ! 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 78 | */ 79 | 80 | #define MD4_LONG unsigned int 81 | 82 | #define MD4_CBLOCK 64 83 | #define MD4_LBLOCK (MD4_CBLOCK/4) 84 | #define MD4_DIGEST_LENGTH 16 85 | 86 | typedef struct MD4state_st 87 | { 88 | MD4_LONG A,B,C,D; 89 | MD4_LONG Nl,Nh; 90 | MD4_LONG data[MD4_LBLOCK]; 91 | unsigned int num; 92 | } MD4_CTX; 93 | 94 | int MD4_Init(MD4_CTX *c); 95 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); 96 | int MD4_Final(unsigned char *md, MD4_CTX *c); 97 | unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); 98 | void MD4_Transform(MD4_CTX *c, const unsigned char *b); 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/md5.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: md5.h,v 1.20 2014/10/20 13:06:54 bcook Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #include 60 | 61 | #ifndef HEADER_MD5_H 62 | #define HEADER_MD5_H 63 | #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__OpenBSD__) 64 | #define __bounded__(x, y, z) 65 | #endif 66 | 67 | #include 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | #ifdef OPENSSL_NO_MD5 74 | #error MD5 is disabled. 75 | #endif 76 | 77 | /* 78 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 79 | * ! MD5_LONG has to be at least 32 bits wide. ! 80 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 81 | */ 82 | 83 | #define MD5_LONG unsigned int 84 | 85 | #define MD5_CBLOCK 64 86 | #define MD5_LBLOCK (MD5_CBLOCK/4) 87 | #define MD5_DIGEST_LENGTH 16 88 | 89 | typedef struct MD5state_st 90 | { 91 | MD5_LONG A,B,C,D; 92 | MD5_LONG Nl,Nh; 93 | MD5_LONG data[MD5_LBLOCK]; 94 | unsigned int num; 95 | } MD5_CTX; 96 | 97 | int MD5_Init(MD5_CTX *c); 98 | int MD5_Update(MD5_CTX *c, const void *data, size_t len) 99 | __attribute__ ((__bounded__(__buffer__,2,3))); 100 | int MD5_Final(unsigned char *md, MD5_CTX *c); 101 | unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) 102 | __attribute__ ((__bounded__(__buffer__,1,2))); 103 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/modes.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: modes.h,v 1.3 2018/07/24 10:47:19 bcook Exp $ */ 2 | /* ==================================================================== 3 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 4 | * 5 | * Rights for redistribution and usage in source and binary 6 | * forms are granted according to the OpenSSL license. 7 | */ 8 | 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef void (*block128_f)(const unsigned char in[16], 16 | unsigned char out[16], 17 | const void *key); 18 | 19 | typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out, 20 | size_t len, const void *key, 21 | unsigned char ivec[16], int enc); 22 | 23 | typedef void (*ctr128_f)(const unsigned char *in, unsigned char *out, 24 | size_t blocks, const void *key, 25 | const unsigned char ivec[16]); 26 | 27 | typedef void (*ccm128_f)(const unsigned char *in, unsigned char *out, 28 | size_t blocks, const void *key, 29 | const unsigned char ivec[16],unsigned char cmac[16]); 30 | 31 | void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, 32 | size_t len, const void *key, 33 | unsigned char ivec[16], block128_f block); 34 | void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, 35 | size_t len, const void *key, 36 | unsigned char ivec[16], block128_f block); 37 | 38 | void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, 39 | size_t len, const void *key, 40 | unsigned char ivec[16], unsigned char ecount_buf[16], 41 | unsigned int *num, block128_f block); 42 | 43 | void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, 44 | size_t len, const void *key, 45 | unsigned char ivec[16], unsigned char ecount_buf[16], 46 | unsigned int *num, ctr128_f ctr); 47 | 48 | void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, 49 | size_t len, const void *key, 50 | unsigned char ivec[16], int *num, 51 | block128_f block); 52 | 53 | void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, 54 | size_t len, const void *key, 55 | unsigned char ivec[16], int *num, 56 | int enc, block128_f block); 57 | void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, 58 | size_t length, const void *key, 59 | unsigned char ivec[16], int *num, 60 | int enc, block128_f block); 61 | void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, 62 | size_t bits, const void *key, 63 | unsigned char ivec[16], int *num, 64 | int enc, block128_f block); 65 | 66 | size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out, 67 | size_t len, const void *key, 68 | unsigned char ivec[16], block128_f block); 69 | size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, 70 | size_t len, const void *key, 71 | unsigned char ivec[16], cbc128_f cbc); 72 | size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out, 73 | size_t len, const void *key, 74 | unsigned char ivec[16], block128_f block); 75 | size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, 76 | size_t len, const void *key, 77 | unsigned char ivec[16], cbc128_f cbc); 78 | 79 | size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *out, 80 | size_t len, const void *key, 81 | unsigned char ivec[16], block128_f block); 82 | size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, 83 | size_t len, const void *key, 84 | unsigned char ivec[16], cbc128_f cbc); 85 | size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *out, 86 | size_t len, const void *key, 87 | unsigned char ivec[16], block128_f block); 88 | size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, 89 | size_t len, const void *key, 90 | unsigned char ivec[16], cbc128_f cbc); 91 | 92 | typedef struct gcm128_context GCM128_CONTEXT; 93 | 94 | GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); 95 | void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block); 96 | void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, 97 | size_t len); 98 | int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, 99 | size_t len); 100 | int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, 101 | const unsigned char *in, unsigned char *out, 102 | size_t len); 103 | int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, 104 | const unsigned char *in, unsigned char *out, 105 | size_t len); 106 | int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, 107 | const unsigned char *in, unsigned char *out, 108 | size_t len, ctr128_f stream); 109 | int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, 110 | const unsigned char *in, unsigned char *out, 111 | size_t len, ctr128_f stream); 112 | int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag, 113 | size_t len); 114 | void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); 115 | void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); 116 | 117 | typedef struct ccm128_context CCM128_CONTEXT; 118 | 119 | void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, 120 | unsigned int M, unsigned int L, void *key,block128_f block); 121 | int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, 122 | const unsigned char *nonce, size_t nlen, size_t mlen); 123 | void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, 124 | const unsigned char *aad, size_t alen); 125 | int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, 126 | const unsigned char *inp, unsigned char *out, size_t len); 127 | int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, 128 | const unsigned char *inp, unsigned char *out, size_t len); 129 | int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, 130 | const unsigned char *inp, unsigned char *out, size_t len, 131 | ccm128_f stream); 132 | int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, 133 | const unsigned char *inp, unsigned char *out, size_t len, 134 | ccm128_f stream); 135 | size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); 136 | 137 | typedef struct xts128_context XTS128_CONTEXT; 138 | 139 | int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], 140 | const unsigned char *inp, unsigned char *out, size_t len, int enc); 141 | 142 | #ifdef __cplusplus 143 | } 144 | #endif 145 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/opensslconf.h: -------------------------------------------------------------------------------- 1 | #include 2 | /* crypto/opensslconf.h.in */ 3 | 4 | #if defined(_MSC_VER) && !defined(__attribute__) 5 | #define __attribute__(a) 6 | #endif 7 | 8 | #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) 9 | #define OPENSSLDIR "/etc/ssl" 10 | #endif 11 | 12 | #undef OPENSSL_UNISTD 13 | #define OPENSSL_UNISTD 14 | 15 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION 16 | 17 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) 18 | #define IDEA_INT unsigned int 19 | #endif 20 | 21 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) 22 | #define MD2_INT unsigned int 23 | #endif 24 | 25 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) 26 | /* I need to put in a mod for the alpha - eay */ 27 | #define RC2_INT unsigned int 28 | #endif 29 | 30 | #if defined(HEADER_RC4_H) 31 | #if !defined(RC4_INT) 32 | /* using int types make the structure larger but make the code faster 33 | * on most boxes I have tested - up to %20 faster. */ 34 | /* 35 | * I don't know what does "most" mean, but declaring "int" is a must on: 36 | * - Intel P6 because partial register stalls are very expensive; 37 | * - elder Alpha because it lacks byte load/store instructions; 38 | */ 39 | #define RC4_INT unsigned int 40 | #endif 41 | #if !defined(RC4_CHUNK) 42 | /* 43 | * This enables code handling data aligned at natural CPU word 44 | * boundary. See crypto/rc4/rc4_enc.c for further details. 45 | */ 46 | #define RC4_CHUNK unsigned long 47 | #endif 48 | #endif 49 | 50 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) 51 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a 52 | * %20 speed up (longs are 8 bytes, int's are 4). */ 53 | #ifndef DES_LONG 54 | #define DES_LONG unsigned int 55 | #endif 56 | #endif 57 | 58 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) 59 | #define CONFIG_HEADER_BN_H 60 | #undef BN_LLONG 61 | 62 | /* Should we define BN_DIV2W here? */ 63 | 64 | /* Only one for the following should be defined */ 65 | #define SIXTY_FOUR_BIT_LONG 66 | #undef SIXTY_FOUR_BIT 67 | #undef THIRTY_TWO_BIT 68 | #endif 69 | 70 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) 71 | #define CONFIG_HEADER_RC4_LOCL_H 72 | /* if this is defined data[i] is used instead of *data, this is a %20 73 | * speedup on x86 */ 74 | #undef RC4_INDEX 75 | #endif 76 | 77 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) 78 | #define CONFIG_HEADER_BF_LOCL_H 79 | #undef BF_PTR 80 | #endif /* HEADER_BF_LOCL_H */ 81 | 82 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) 83 | #define CONFIG_HEADER_DES_LOCL_H 84 | #ifndef DES_DEFAULT_OPTIONS 85 | /* the following is tweaked from a config script, that is why it is a 86 | * protected undef/define */ 87 | #ifndef DES_PTR 88 | #undef DES_PTR 89 | #endif 90 | 91 | /* This helps C compiler generate the correct code for multiple functional 92 | * units. It reduces register dependancies at the expense of 2 more 93 | * registers */ 94 | #ifndef DES_RISC1 95 | #undef DES_RISC1 96 | #endif 97 | 98 | #ifndef DES_RISC2 99 | #undef DES_RISC2 100 | #endif 101 | 102 | #if defined(DES_RISC1) && defined(DES_RISC2) 103 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! 104 | #endif 105 | 106 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. 107 | * Very mucy CPU dependant */ 108 | #ifndef DES_UNROLL 109 | #define DES_UNROLL 110 | #endif 111 | 112 | /* These default values were supplied by 113 | * Peter Gutman 114 | * They are only used if nothing else has been defined */ 115 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) 116 | /* Special defines which change the way the code is built depending on the 117 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find 118 | even newer MIPS CPU's, but at the moment one size fits all for 119 | optimization options. Older Sparc's work better with only UNROLL, but 120 | there's no way to tell at compile time what it is you're running on */ 121 | 122 | #if defined( sun ) /* Newer Sparc's */ 123 | # define DES_PTR 124 | # define DES_RISC1 125 | # define DES_UNROLL 126 | #elif defined( __ultrix ) /* Older MIPS */ 127 | # define DES_PTR 128 | # define DES_RISC2 129 | # define DES_UNROLL 130 | #elif defined( __osf1__ ) /* Alpha */ 131 | # define DES_PTR 132 | # define DES_RISC2 133 | #elif defined ( _AIX ) /* RS6000 */ 134 | /* Unknown */ 135 | #elif defined( __hpux ) /* HP-PA */ 136 | /* Unknown */ 137 | #elif defined( __aux ) /* 68K */ 138 | /* Unknown */ 139 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ 140 | # define DES_UNROLL 141 | #elif defined( __sgi ) /* Newer MIPS */ 142 | # define DES_PTR 143 | # define DES_RISC2 144 | # define DES_UNROLL 145 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ 146 | # define DES_PTR 147 | # define DES_RISC1 148 | # define DES_UNROLL 149 | #endif /* Systems-specific speed defines */ 150 | #endif 151 | 152 | #endif /* DES_DEFAULT_OPTIONS */ 153 | #endif /* HEADER_DES_LOCL_H */ 154 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/opensslfeatures.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Feature flags for LibreSSL... so you can actually tell when things 3 | * are enabled, rather than not being able to tell when things are 4 | * enabled (or possibly not yet not implemented, or removed!). 5 | */ 6 | #define LIBRESSL_HAS_TLS1_3 7 | #define LIBRESSL_HAS_DTLS1_2 8 | 9 | #define OPENSSL_THREADS 10 | 11 | #define OPENSSL_NO_BUF_FREELISTS 12 | #define OPENSSL_NO_GMP 13 | #define OPENSSL_NO_JPAKE 14 | #define OPENSSL_NO_KRB5 15 | #define OPENSSL_NO_RSAX 16 | #define OPENSSL_NO_SHA0 17 | #define OPENSSL_NO_SSL2 18 | #define OPENSSL_NO_STORE 19 | 20 | /* 21 | * OPENSSL_NO_* flags that currently appear in OpenSSL. 22 | */ 23 | 24 | /* #define OPENSSL_NO_AFALGENG */ 25 | /* #define OPENSSL_NO_ALGORITHMS */ 26 | /* #define OPENSSL_NO_ARIA */ 27 | /* #define OPENSSL_NO_ASM */ 28 | #define OPENSSL_NO_ASYNC 29 | /* #define OPENSSL_NO_AUTOALGINIT */ 30 | /* #define OPENSSL_NO_AUTOERRINIT */ 31 | /* #define OPENSSL_NO_AUTOLOAD_CONFIG */ 32 | /* #define OPENSSL_NO_BF */ 33 | /* #define OPENSSL_NO_BLAKE2 */ 34 | /* #define OPENSSL_NO_CAMELLIA */ 35 | /* #define OPENSSL_NO_CAPIENG */ 36 | /* #define OPENSSL_NO_CAST */ 37 | /* #define OPENSSL_NO_CHACHA */ 38 | /* #define OPENSSL_NO_CMAC */ 39 | /* #define OPENSSL_NO_CMS */ 40 | #define OPENSSL_NO_COMP /* XXX */ 41 | /* #define OPENSSL_NO_CRYPTO_MDEBUG */ 42 | /* #define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE */ 43 | /* #define OPENSSL_NO_CT */ 44 | /* #define OPENSSL_NO_DECC_INIT */ 45 | /* #define OPENSSL_NO_DES */ 46 | /* #define OPENSSL_NO_DEVCRYPTOENG */ 47 | /* #define OPENSSL_NO_DGRAM */ 48 | /* #define OPENSSL_NO_DH */ 49 | /* #define OPENSSL_NO_DSA */ 50 | /* #define OPENSSL_NO_DSO */ 51 | /* #define OPENSSL_NO_DTLS */ 52 | /* #define OPENSSL_NO_DTLS1 */ 53 | /* #define OPENSSL_NO_DTLS1_2 */ 54 | /* #define OPENSSL_NO_DTLS1_2_METHOD */ 55 | /* #define OPENSSL_NO_DTLS1_METHOD */ 56 | #define OPENSSL_NO_DYNAMIC_ENGINE 57 | /* #define OPENSSL_NO_EC */ 58 | /* #define OPENSSL_NO_EC2M */ 59 | #define OPENSSL_NO_EC_NISTP_64_GCC_128 60 | #define OPENSSL_NO_EGD 61 | /* #define OPENSSL_NO_ENGINE */ 62 | /* #define OPENSSL_NO_ERR */ 63 | /* #define OPENSSL_NO_FUZZ_AFL */ 64 | /* #define OPENSSL_NO_FUZZ_LIBFUZZER */ 65 | /* #define OPENSSL_NO_GOST */ 66 | #define OPENSSL_NO_HEARTBEATS 67 | /* #define OPENSSL_NO_HW */ 68 | /* #define OPENSSL_NO_HW_PADLOCK */ 69 | /* #define OPENSSL_NO_IDEA */ 70 | /* #define OPENSSL_NO_INLINE_ASM */ 71 | #define OPENSSL_NO_MD2 72 | /* #define OPENSSL_NO_MD4 */ 73 | /* #define OPENSSL_NO_MD5 */ 74 | #define OPENSSL_NO_MDC2 75 | /* #define OPENSSL_NO_MULTIBLOCK */ 76 | /* #define OPENSSL_NO_NEXTPROTONEG */ 77 | /* #define OPENSSL_NO_OCB */ 78 | /* #define OPENSSL_NO_OCSP */ 79 | /* #define OPENSSL_NO_PINSHARED */ 80 | /* #define OPENSSL_NO_POLY1305 */ 81 | /* #define OPENSSL_NO_POSIX_IO */ 82 | #define OPENSSL_NO_PSK 83 | /* #define OPENSSL_NO_RC2 */ 84 | /* #define OPENSSL_NO_RC4 */ 85 | #define OPENSSL_NO_RC5 86 | /* #define OPENSSL_NO_RDRAND */ 87 | /* #define OPENSSL_NO_RFC3779 */ 88 | /* #define OPENSSL_NO_RMD160 */ 89 | /* #define OPENSSL_NO_RSA */ 90 | /* #define OPENSSL_NO_SCRYPT */ 91 | #define OPENSSL_NO_SCTP 92 | /* #define OPENSSL_NO_SECURE_MEMORY */ 93 | #define OPENSSL_NO_SEED 94 | /* #define OPENSSL_NO_SIPHASH */ 95 | /* #define OPENSSL_NO_SM2 */ 96 | /* #define OPENSSL_NO_SM3 */ 97 | /* #define OPENSSL_NO_SM4 */ 98 | /* #define OPENSSL_NO_SOCK */ 99 | #define OPENSSL_NO_SRP 100 | /* #define OPENSSL_NO_SRTP */ 101 | #define OPENSSL_NO_SSL3 102 | #define OPENSSL_NO_SSL3_METHOD 103 | #define OPENSSL_NO_SSL_TRACE 104 | /* #define OPENSSL_NO_STATIC_ENGINE */ 105 | /* #define OPENSSL_NO_STDIO */ 106 | /* #define OPENSSL_NO_TLS */ 107 | /* #define OPENSSL_NO_TLS1 */ 108 | /* #define OPENSSL_NO_TLS1_1 */ 109 | /* #define OPENSSL_NO_TLS1_1_METHOD */ 110 | /* #define OPENSSL_NO_TLS1_2 */ 111 | /* #define OPENSSL_NO_TLS1_2_METHOD */ 112 | #ifndef LIBRESSL_HAS_TLS1_3 113 | #define OPENSSL_NO_TLS1_3 114 | #endif 115 | /* #define OPENSSL_NO_TLS1_METHOD */ 116 | /* #define OPENSSL_NO_TS */ 117 | /* #define OPENSSL_NO_UI_CONSOLE */ 118 | /* #define OPENSSL_NO_UNIT_TEST */ 119 | /* #define OPENSSL_NO_WEAK_SSL_CIPHERS */ 120 | /* #define OPENSSL_NO_WHIRLPOOL */ 121 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: opensslv.h,v 1.69 2022/03/15 21:15:08 bcook Exp $ */ 2 | #ifndef HEADER_OPENSSLV_H 3 | #define HEADER_OPENSSLV_H 4 | 5 | /* These will change with each release of LibreSSL-portable */ 6 | #define LIBRESSL_VERSION_NUMBER 0x3050300fL 7 | /* ^ Patch starts here */ 8 | #define LIBRESSL_VERSION_TEXT "LibreSSL 3.5.3" 9 | 10 | /* These will never change */ 11 | #define OPENSSL_VERSION_NUMBER 0x20000000L 12 | #define OPENSSL_VERSION_TEXT LIBRESSL_VERSION_TEXT 13 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT 14 | 15 | #define SHLIB_VERSION_HISTORY "" 16 | #define SHLIB_VERSION_NUMBER "1.0.0" 17 | 18 | #endif /* HEADER_OPENSSLV_H */ 19 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/ossl_typ.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: ossl_typ.h,v 1.21 2022/01/14 08:59:30 tb Exp $ */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | #ifndef HEADER_OPENSSL_TYPES_H 57 | #define HEADER_OPENSSL_TYPES_H 58 | 59 | #include 60 | 61 | typedef struct asn1_string_st ASN1_INTEGER; 62 | typedef struct asn1_string_st ASN1_ENUMERATED; 63 | typedef struct asn1_string_st ASN1_BIT_STRING; 64 | typedef struct asn1_string_st ASN1_OCTET_STRING; 65 | typedef struct asn1_string_st ASN1_PRINTABLESTRING; 66 | typedef struct asn1_string_st ASN1_T61STRING; 67 | typedef struct asn1_string_st ASN1_IA5STRING; 68 | typedef struct asn1_string_st ASN1_GENERALSTRING; 69 | typedef struct asn1_string_st ASN1_UNIVERSALSTRING; 70 | typedef struct asn1_string_st ASN1_BMPSTRING; 71 | typedef struct asn1_string_st ASN1_UTCTIME; 72 | typedef struct asn1_string_st ASN1_TIME; 73 | typedef struct asn1_string_st ASN1_GENERALIZEDTIME; 74 | typedef struct asn1_string_st ASN1_VISIBLESTRING; 75 | typedef struct asn1_string_st ASN1_UTF8STRING; 76 | typedef struct asn1_string_st ASN1_STRING; 77 | typedef int ASN1_BOOLEAN; 78 | typedef int ASN1_NULL; 79 | 80 | typedef struct asn1_object_st ASN1_OBJECT; 81 | 82 | typedef struct ASN1_ITEM_st ASN1_ITEM; 83 | typedef struct asn1_pctx_st ASN1_PCTX; 84 | 85 | #if defined(_WIN32) && defined(__WINCRYPT_H__) 86 | #ifndef LIBRESSL_INTERNAL 87 | #ifdef _MSC_VER 88 | #pragma message("Warning, overriding WinCrypt defines") 89 | #else 90 | #warning overriding WinCrypt defines 91 | #endif 92 | #endif 93 | #undef X509_NAME 94 | #undef X509_CERT_PAIR 95 | #undef X509_EXTENSIONS 96 | #undef OCSP_REQUEST 97 | #undef OCSP_RESPONSE 98 | #undef PKCS7_ISSUER_AND_SERIAL 99 | #endif 100 | 101 | #ifdef BIGNUM 102 | #undef BIGNUM 103 | #endif 104 | typedef struct bignum_st BIGNUM; 105 | typedef struct bignum_ctx BN_CTX; 106 | typedef struct bn_blinding_st BN_BLINDING; 107 | typedef struct bn_mont_ctx_st BN_MONT_CTX; 108 | typedef struct bn_recp_ctx_st BN_RECP_CTX; 109 | typedef struct bn_gencb_st BN_GENCB; 110 | 111 | typedef struct bio_st BIO; 112 | typedef struct buf_mem_st BUF_MEM; 113 | 114 | typedef struct comp_ctx_st COMP_CTX; 115 | typedef struct comp_method_st COMP_METHOD; 116 | 117 | typedef struct evp_cipher_st EVP_CIPHER; 118 | typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; 119 | typedef struct env_md_st EVP_MD; 120 | typedef struct env_md_ctx_st EVP_MD_CTX; 121 | typedef struct evp_pkey_st EVP_PKEY; 122 | 123 | typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; 124 | 125 | typedef struct evp_pkey_method_st EVP_PKEY_METHOD; 126 | typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; 127 | 128 | typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; 129 | 130 | typedef struct hmac_ctx_st HMAC_CTX; 131 | 132 | typedef struct dh_st DH; 133 | typedef struct dh_method DH_METHOD; 134 | 135 | typedef struct dsa_st DSA; 136 | typedef struct dsa_method DSA_METHOD; 137 | 138 | typedef struct rsa_st RSA; 139 | typedef struct rsa_meth_st RSA_METHOD; 140 | typedef struct rsa_pss_params_st RSA_PSS_PARAMS; 141 | 142 | typedef struct rand_meth_st RAND_METHOD; 143 | 144 | typedef struct ecdh_method ECDH_METHOD; 145 | typedef struct ecdsa_method ECDSA_METHOD; 146 | 147 | typedef struct x509_st X509; 148 | typedef struct X509_algor_st X509_ALGOR; 149 | typedef struct X509_crl_st X509_CRL; 150 | typedef struct x509_crl_method_st X509_CRL_METHOD; 151 | typedef struct x509_revoked_st X509_REVOKED; 152 | typedef struct X509_name_st X509_NAME; 153 | typedef struct X509_pubkey_st X509_PUBKEY; 154 | typedef struct x509_store_st X509_STORE; 155 | typedef struct x509_store_ctx_st X509_STORE_CTX; 156 | 157 | typedef struct x509_object_st X509_OBJECT; 158 | typedef struct x509_lookup_st X509_LOOKUP; 159 | typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; 160 | typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; 161 | 162 | typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; 163 | 164 | typedef struct v3_ext_ctx X509V3_CTX; 165 | typedef struct conf_st CONF; 166 | 167 | typedef struct store_st STORE; 168 | typedef struct store_method_st STORE_METHOD; 169 | 170 | typedef struct ui_st UI; 171 | typedef struct ui_method_st UI_METHOD; 172 | 173 | typedef struct st_ERR_FNS ERR_FNS; 174 | 175 | typedef struct engine_st ENGINE; 176 | typedef struct ssl_st SSL; 177 | typedef struct ssl_ctx_st SSL_CTX; 178 | 179 | typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; 180 | typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; 181 | typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; 182 | typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; 183 | 184 | typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; 185 | typedef struct DIST_POINT_st DIST_POINT; 186 | typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; 187 | typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; 188 | 189 | /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ 190 | #define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ 191 | #define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ 192 | 193 | typedef struct crypto_ex_data_st CRYPTO_EX_DATA; 194 | /* Callback types for crypto.h */ 195 | typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, 196 | int idx, long argl, void *argp); 197 | typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, 198 | int idx, long argl, void *argp); 199 | typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, 200 | void *from_d, int idx, long argl, void *argp); 201 | 202 | typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; 203 | typedef struct ocsp_response_st OCSP_RESPONSE; 204 | typedef struct ocsp_responder_id_st OCSP_RESPID; 205 | 206 | typedef struct sct_st SCT; 207 | typedef struct sct_ctx_st SCT_CTX; 208 | typedef struct ctlog_st CTLOG; 209 | typedef struct ctlog_store_st CTLOG_STORE; 210 | typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; 211 | 212 | #endif /* def HEADER_OPENSSL_TYPES_H */ 213 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: pem2.h,v 1.5 2014/06/12 15:49:30 deraadt Exp $ */ 2 | /* ==================================================================== 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * licensing@OpenSSL.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | /* 57 | * This header only exists to break a circular dependency between pem and err 58 | * Ben 30 Jan 1999. 59 | */ 60 | 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif 64 | 65 | #ifndef HEADER_PEM_H 66 | void ERR_load_PEM_strings(void); 67 | #endif 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/poly1305.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: poly1305.h,v 1.3 2014/07/25 14:04:51 jsing Exp $ */ 2 | /* 3 | * Copyright (c) 2014 Joel Sing 4 | * 5 | * Permission to use, copy, modify, and distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | #ifndef HEADER_POLY1305_H 19 | #define HEADER_POLY1305_H 20 | 21 | #include 22 | 23 | #if defined(OPENSSL_NO_POLY1305) 24 | #error Poly1305 is disabled. 25 | #endif 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | typedef struct poly1305_context { 34 | size_t aligner; 35 | unsigned char opaque[136]; 36 | } poly1305_context; 37 | 38 | typedef struct poly1305_context poly1305_state; 39 | 40 | void CRYPTO_poly1305_init(poly1305_context *ctx, const unsigned char key[32]); 41 | void CRYPTO_poly1305_update(poly1305_context *ctx, const unsigned char *in, 42 | size_t len); 43 | void CRYPTO_poly1305_finish(poly1305_context *ctx, unsigned char mac[16]); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* HEADER_POLY1305_H */ 50 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/rand.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: rand.h,v 1.22 2014/10/22 14:02:52 jsing Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #include 60 | 61 | #ifndef HEADER_RAND_H 62 | #define HEADER_RAND_H 63 | 64 | #include 65 | 66 | #include 67 | 68 | #ifdef __cplusplus 69 | extern "C" { 70 | #endif 71 | 72 | /* Already defined in ossl_typ.h */ 73 | /* typedef struct rand_meth_st RAND_METHOD; */ 74 | 75 | struct rand_meth_st { 76 | void (*seed)(const void *buf, int num); 77 | int (*bytes)(unsigned char *buf, int num); 78 | void (*cleanup)(void); 79 | void (*add)(const void *buf, int num, double entropy); 80 | int (*pseudorand)(unsigned char *buf, int num); 81 | int (*status)(void); 82 | }; 83 | 84 | int RAND_set_rand_method(const RAND_METHOD *meth); 85 | const RAND_METHOD *RAND_get_rand_method(void); 86 | #ifndef OPENSSL_NO_ENGINE 87 | int RAND_set_rand_engine(ENGINE *engine); 88 | #endif 89 | RAND_METHOD *RAND_SSLeay(void); 90 | 91 | #ifndef LIBRESSL_INTERNAL 92 | void RAND_cleanup(void ); 93 | int RAND_bytes(unsigned char *buf, int num); 94 | int RAND_pseudo_bytes(unsigned char *buf, int num); 95 | void RAND_seed(const void *buf, int num); 96 | void RAND_add(const void *buf, int num, double entropy); 97 | int RAND_load_file(const char *file, long max_bytes); 98 | int RAND_write_file(const char *file); 99 | const char *RAND_file_name(char *file, size_t num); 100 | int RAND_status(void); 101 | int RAND_poll(void); 102 | #endif 103 | 104 | /* BEGIN ERROR CODES */ 105 | /* The following lines are auto generated by the script mkerr.pl. Any changes 106 | * made after this point may be overwritten when the script is next run. 107 | */ 108 | void ERR_load_RAND_strings(void); 109 | 110 | /* Error codes for the RAND functions. (no longer used) */ 111 | 112 | /* Function codes. */ 113 | #define RAND_F_RAND_GET_RAND_METHOD 101 114 | #define RAND_F_RAND_INIT_FIPS 102 115 | #define RAND_F_SSLEAY_RAND_BYTES 100 116 | 117 | /* Reason codes. */ 118 | #define RAND_R_DUAL_EC_DRBG_DISABLED 104 119 | #define RAND_R_ERROR_INITIALISING_DRBG 102 120 | #define RAND_R_ERROR_INSTANTIATING_DRBG 103 121 | #define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 122 | #define RAND_R_PRNG_NOT_SEEDED 100 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | #endif 128 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/rc2.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: rc2.h,v 1.11 2014/07/10 22:45:57 jsing Exp $ */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC2_H 60 | #define HEADER_RC2_H 61 | 62 | #include /* OPENSSL_NO_RC2, RC2_INT */ 63 | 64 | #ifdef OPENSSL_NO_RC2 65 | #error RC2 is disabled. 66 | #endif 67 | 68 | #define RC2_ENCRYPT 1 69 | #define RC2_DECRYPT 0 70 | 71 | #define RC2_BLOCK 8 72 | #define RC2_KEY_LENGTH 16 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | typedef struct rc2_key_st 79 | { 80 | RC2_INT data[64]; 81 | } RC2_KEY; 82 | 83 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); 84 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, 85 | int enc); 86 | void RC2_encrypt(unsigned long *data,RC2_KEY *key); 87 | void RC2_decrypt(unsigned long *data,RC2_KEY *key); 88 | void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 89 | RC2_KEY *ks, unsigned char *iv, int enc); 90 | void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, 91 | long length, RC2_KEY *schedule, unsigned char *ivec, 92 | int *num, int enc); 93 | void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, 94 | long length, RC2_KEY *schedule, unsigned char *ivec, 95 | int *num); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: rc4.h,v 1.13 2015/10/20 15:50:13 jsing Exp $ */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC4_H 60 | #define HEADER_RC4_H 61 | 62 | #include /* OPENSSL_NO_RC4, RC4_INT */ 63 | 64 | #ifdef OPENSSL_NO_RC4 65 | #error RC4 is disabled. 66 | #endif 67 | 68 | #include 69 | 70 | #ifdef __cplusplus 71 | extern "C" { 72 | #endif 73 | 74 | typedef struct rc4_key_st { 75 | RC4_INT x, y; 76 | RC4_INT data[256]; 77 | } RC4_KEY; 78 | 79 | const char *RC4_options(void); 80 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 81 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 82 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 83 | unsigned char *outdata); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/ripemd.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: ripemd.h,v 1.14 2014/07/10 22:45:57 jsing Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #include 60 | 61 | #ifndef HEADER_RIPEMD_H 62 | #define HEADER_RIPEMD_H 63 | 64 | #include 65 | 66 | #ifdef __cplusplus 67 | extern "C" { 68 | #endif 69 | 70 | #ifdef OPENSSL_NO_RIPEMD 71 | #error RIPEMD is disabled. 72 | #endif 73 | 74 | #if defined(__LP32__) 75 | #define RIPEMD160_LONG unsigned long 76 | #elif defined(__ILP64__) 77 | #define RIPEMD160_LONG unsigned long 78 | #define RIPEMD160_LONG_LOG2 3 79 | #else 80 | #define RIPEMD160_LONG unsigned int 81 | #endif 82 | 83 | #define RIPEMD160_CBLOCK 64 84 | #define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) 85 | #define RIPEMD160_DIGEST_LENGTH 20 86 | 87 | typedef struct RIPEMD160state_st 88 | { 89 | RIPEMD160_LONG A,B,C,D,E; 90 | RIPEMD160_LONG Nl,Nh; 91 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; 92 | unsigned int num; 93 | } RIPEMD160_CTX; 94 | 95 | int RIPEMD160_Init(RIPEMD160_CTX *c); 96 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); 97 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); 98 | unsigned char *RIPEMD160(const unsigned char *d, size_t n, 99 | unsigned char *md); 100 | void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/sha.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: sha.h,v 1.21 2015/09/13 21:09:56 doug Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #include 60 | 61 | #ifndef HEADER_SHA_H 62 | #define HEADER_SHA_H 63 | #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__OpenBSD__) 64 | #define __bounded__(x, y, z) 65 | #endif 66 | 67 | #include 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA1) 74 | #error SHA is disabled. 75 | #endif 76 | 77 | /* 78 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 79 | * ! SHA_LONG has to be at least 32 bits wide. ! 80 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 81 | */ 82 | 83 | #define SHA_LONG unsigned int 84 | 85 | #define SHA_LBLOCK 16 86 | #define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a 87 | * contiguous array of 32 bit 88 | * wide big-endian values. */ 89 | #define SHA_LAST_BLOCK (SHA_CBLOCK-8) 90 | #define SHA_DIGEST_LENGTH 20 91 | 92 | typedef struct SHAstate_st 93 | { 94 | SHA_LONG h0,h1,h2,h3,h4; 95 | SHA_LONG Nl,Nh; 96 | SHA_LONG data[SHA_LBLOCK]; 97 | unsigned int num; 98 | } SHA_CTX; 99 | 100 | #ifndef OPENSSL_NO_SHA1 101 | int SHA1_Init(SHA_CTX *c); 102 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len) 103 | __attribute__ ((__bounded__(__buffer__,2,3))); 104 | int SHA1_Final(unsigned char *md, SHA_CTX *c); 105 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) 106 | __attribute__ ((__bounded__(__buffer__,1,2))); 107 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); 108 | #endif 109 | 110 | #define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a 111 | * contiguous array of 32 bit 112 | * wide big-endian values. */ 113 | #define SHA224_DIGEST_LENGTH 28 114 | #define SHA256_DIGEST_LENGTH 32 115 | 116 | typedef struct SHA256state_st 117 | { 118 | SHA_LONG h[8]; 119 | SHA_LONG Nl,Nh; 120 | SHA_LONG data[SHA_LBLOCK]; 121 | unsigned int num,md_len; 122 | } SHA256_CTX; 123 | 124 | #ifndef OPENSSL_NO_SHA256 125 | int SHA224_Init(SHA256_CTX *c); 126 | int SHA224_Update(SHA256_CTX *c, const void *data, size_t len) 127 | __attribute__ ((__bounded__(__buffer__,2,3))); 128 | int SHA224_Final(unsigned char *md, SHA256_CTX *c); 129 | unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md) 130 | __attribute__ ((__bounded__(__buffer__,1,2))); 131 | int SHA256_Init(SHA256_CTX *c); 132 | int SHA256_Update(SHA256_CTX *c, const void *data, size_t len) 133 | __attribute__ ((__bounded__(__buffer__,2,3))); 134 | int SHA256_Final(unsigned char *md, SHA256_CTX *c); 135 | unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md) 136 | __attribute__ ((__bounded__(__buffer__,1,2))); 137 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); 138 | #endif 139 | 140 | #define SHA384_DIGEST_LENGTH 48 141 | #define SHA512_DIGEST_LENGTH 64 142 | 143 | #ifndef OPENSSL_NO_SHA512 144 | /* 145 | * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 146 | * being exactly 64-bit wide. See Implementation Notes in sha512.c 147 | * for further details. 148 | */ 149 | #define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a 150 | * contiguous array of 64 bit 151 | * wide big-endian values. */ 152 | #if defined(_LP64) 153 | #define SHA_LONG64 unsigned long 154 | #define U64(C) C##UL 155 | #else 156 | #define SHA_LONG64 unsigned long long 157 | #define U64(C) C##ULL 158 | #endif 159 | 160 | typedef struct SHA512state_st 161 | { 162 | SHA_LONG64 h[8]; 163 | SHA_LONG64 Nl,Nh; 164 | union { 165 | SHA_LONG64 d[SHA_LBLOCK]; 166 | unsigned char p[SHA512_CBLOCK]; 167 | } u; 168 | unsigned int num,md_len; 169 | } SHA512_CTX; 170 | #endif 171 | 172 | #ifndef OPENSSL_NO_SHA512 173 | int SHA384_Init(SHA512_CTX *c); 174 | int SHA384_Update(SHA512_CTX *c, const void *data, size_t len) 175 | __attribute__ ((__bounded__(__buffer__,2,3))); 176 | int SHA384_Final(unsigned char *md, SHA512_CTX *c); 177 | unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md) 178 | __attribute__ ((__bounded__(__buffer__,1,2))); 179 | int SHA512_Init(SHA512_CTX *c); 180 | int SHA512_Update(SHA512_CTX *c, const void *data, size_t len) 181 | __attribute__ ((__bounded__(__buffer__,2,3))); 182 | int SHA512_Final(unsigned char *md, SHA512_CTX *c); 183 | unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md) 184 | __attribute__ ((__bounded__(__buffer__,1,2))); 185 | void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); 186 | #endif 187 | 188 | #ifdef __cplusplus 189 | } 190 | #endif 191 | 192 | #endif 193 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/sm3.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: sm3.h,v 1.1 2018/11/11 06:53:31 tb Exp $ */ 2 | /* 3 | * Copyright (c) 2018, Ribose Inc 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | #ifndef HEADER_SM3_H 19 | #define HEADER_SM3_H 20 | 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #ifdef OPENSSL_NO_SM3 29 | #error SM3 is disabled. 30 | #endif 31 | 32 | #define SM3_DIGEST_LENGTH 32 33 | #define SM3_WORD unsigned int 34 | 35 | #define SM3_CBLOCK 64 36 | #define SM3_LBLOCK (SM3_CBLOCK / 4) 37 | 38 | typedef struct SM3state_st { 39 | SM3_WORD A, B, C, D, E, F, G, H; 40 | SM3_WORD Nl, Nh; 41 | SM3_WORD data[SM3_LBLOCK]; 42 | unsigned int num; 43 | } SM3_CTX; 44 | 45 | int SM3_Init(SM3_CTX *c); 46 | int SM3_Update(SM3_CTX *c, const void *data, size_t len); 47 | int SM3_Final(unsigned char *md, SM3_CTX *c); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* HEADER_SM3_H */ 54 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/sm4.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: sm4.h,v 1.1 2019/03/17 17:42:37 tb Exp $ */ 2 | /* 3 | * Copyright (c) 2017, 2019 Ribose Inc 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | #ifndef HEADER_SM4_H 19 | #define HEADER_SM4_H 20 | 21 | #include 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #ifdef OPENSSL_NO_SM4 30 | #error SM4 is disabled. 31 | #endif 32 | 33 | #define SM4_DECRYPT 0 34 | #define SM4_ENCRYPT 1 35 | 36 | #define SM4_BLOCK_SIZE 16 37 | #define SM4_KEY_SCHEDULE 32 38 | 39 | typedef struct sm4_key_st { 40 | unsigned char opaque[128]; 41 | } SM4_KEY; 42 | 43 | int SM4_set_key(const uint8_t *key, SM4_KEY *ks); 44 | void SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks); 45 | void SM4_encrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* HEADER_SM4_H */ 52 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/srtp.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: srtp.h,v 1.7 2021/06/11 15:28:13 landry Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | /* ==================================================================== 59 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 60 | * 61 | * Redistribution and use in source and binary forms, with or without 62 | * modification, are permitted provided that the following conditions 63 | * are met: 64 | * 65 | * 1. Redistributions of source code must retain the above copyright 66 | * notice, this list of conditions and the following disclaimer. 67 | * 68 | * 2. Redistributions in binary form must reproduce the above copyright 69 | * notice, this list of conditions and the following disclaimer in 70 | * the documentation and/or other materials provided with the 71 | * distribution. 72 | * 73 | * 3. All advertising materials mentioning features or use of this 74 | * software must display the following acknowledgment: 75 | * "This product includes software developed by the OpenSSL Project 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 77 | * 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 79 | * endorse or promote products derived from this software without 80 | * prior written permission. For written permission, please contact 81 | * openssl-core@openssl.org. 82 | * 83 | * 5. Products derived from this software may not be called "OpenSSL" 84 | * nor may "OpenSSL" appear in their names without prior written 85 | * permission of the OpenSSL Project. 86 | * 87 | * 6. Redistributions of any form whatsoever must retain the following 88 | * acknowledgment: 89 | * "This product includes software developed by the OpenSSL Project 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 91 | * 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. 104 | * ==================================================================== 105 | * 106 | * This product includes cryptographic software written by Eric Young 107 | * (eay@cryptsoft.com). This product includes software written by Tim 108 | * Hudson (tjh@cryptsoft.com). 109 | * 110 | */ 111 | /* 112 | * DTLS code by Eric Rescorla 113 | * 114 | * Copyright (C) 2006, Network Resonance, Inc. 115 | * Copyright (C) 2011, RTFM, Inc. 116 | */ 117 | 118 | #ifndef HEADER_D1_SRTP_H 119 | #define HEADER_D1_SRTP_H 120 | 121 | #ifdef __cplusplus 122 | extern "C" { 123 | #endif 124 | 125 | #define SRTP_AES128_CM_SHA1_80 0x0001 126 | #define SRTP_AES128_CM_SHA1_32 0x0002 127 | #define SRTP_AES128_F8_SHA1_80 0x0003 128 | #define SRTP_AES128_F8_SHA1_32 0x0004 129 | #define SRTP_NULL_SHA1_80 0x0005 130 | #define SRTP_NULL_SHA1_32 0x0006 131 | 132 | /* AEAD SRTP protection profiles from RFC 7714 */ 133 | #define SRTP_AEAD_AES_128_GCM 0x0007 134 | #define SRTP_AEAD_AES_256_GCM 0x0008 135 | 136 | int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); 137 | int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles); 138 | 139 | STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); 140 | SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); 141 | 142 | #ifdef __cplusplus 143 | } 144 | #endif 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: ssl2.h,v 1.12 2014/12/14 15:30:50 jsing Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SSL2_H 60 | #define HEADER_SSL2_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /* Protocol Version Codes */ 67 | #define SSL2_VERSION 0x0002 68 | #define SSL2_VERSION_MAJOR 0x00 69 | #define SSL2_VERSION_MINOR 0x02 70 | /* #define SSL2_CLIENT_VERSION 0x0002 */ 71 | /* #define SSL2_SERVER_VERSION 0x0002 */ 72 | 73 | /* Protocol Message Codes */ 74 | #define SSL2_MT_ERROR 0 75 | #define SSL2_MT_CLIENT_HELLO 1 76 | #define SSL2_MT_CLIENT_MASTER_KEY 2 77 | #define SSL2_MT_CLIENT_FINISHED 3 78 | #define SSL2_MT_SERVER_HELLO 4 79 | #define SSL2_MT_SERVER_VERIFY 5 80 | #define SSL2_MT_SERVER_FINISHED 6 81 | #define SSL2_MT_REQUEST_CERTIFICATE 7 82 | #define SSL2_MT_CLIENT_CERTIFICATE 8 83 | 84 | /* Error Message Codes */ 85 | #define SSL2_PE_UNDEFINED_ERROR 0x0000 86 | #define SSL2_PE_NO_CIPHER 0x0001 87 | #define SSL2_PE_NO_CERTIFICATE 0x0002 88 | #define SSL2_PE_BAD_CERTIFICATE 0x0004 89 | #define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006 90 | 91 | /* Cipher Kind Values */ 92 | #define SSL2_CK_NULL_WITH_MD5 0x02000000 /* v3 */ 93 | #define SSL2_CK_RC4_128_WITH_MD5 0x02010080 94 | #define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080 95 | #define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080 96 | #define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080 97 | #define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080 98 | #define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040 99 | #define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140 /* v3 */ 100 | #define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 101 | #define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */ 102 | #define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */ 103 | 104 | #define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */ 105 | #define SSL2_CK_NULL 0x02ff0810 /* SSLeay */ 106 | 107 | #define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1" 108 | #define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5" 109 | #define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5" 110 | #define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5" 111 | #define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5" 112 | #define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5" 113 | #define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5" 114 | #define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5" 115 | #define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA" 116 | #define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5" 117 | #define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA" 118 | #define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5" 119 | 120 | #define SSL2_TXT_NULL "NULL" 121 | 122 | /* Flags for the SSL_CIPHER.algorithm2 field */ 123 | #define SSL2_CF_5_BYTE_ENC 0x01 124 | #define SSL2_CF_8_BYTE_ENC 0x02 125 | 126 | /* Certificate Type Codes */ 127 | #define SSL2_CT_X509_CERTIFICATE 0x01 128 | 129 | /* Authentication Type Code */ 130 | #define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01 131 | 132 | #define SSL2_MAX_SSL_SESSION_ID_LENGTH 32 133 | 134 | /* Upper/Lower Bounds */ 135 | #define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 136 | #define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */ 137 | #define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */ 138 | 139 | #define SSL2_CHALLENGE_LENGTH 16 140 | /*#define SSL2_CHALLENGE_LENGTH 32 */ 141 | #define SSL2_MIN_CHALLENGE_LENGTH 16 142 | #define SSL2_MAX_CHALLENGE_LENGTH 32 143 | #define SSL2_CONNECTION_ID_LENGTH 16 144 | #define SSL2_MAX_CONNECTION_ID_LENGTH 16 145 | #define SSL2_SSL_SESSION_ID_LENGTH 16 146 | #define SSL2_MAX_CERT_CHALLENGE_LENGTH 32 147 | #define SSL2_MIN_CERT_CHALLENGE_LENGTH 16 148 | #define SSL2_MAX_KEY_MATERIAL_LENGTH 24 149 | 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | #endif 154 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/ssl23.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: ssl23.h,v 1.4 2014/12/14 15:30:50 jsing Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SSL23_H 60 | #define HEADER_SSL23_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /*client */ 67 | /* write to server */ 68 | #define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) 69 | #define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) 70 | /* read from server */ 71 | #define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) 72 | #define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) 73 | 74 | /* server */ 75 | /* read from client */ 76 | #define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) 77 | #define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/stack.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: stack.h,v 1.9 2014/06/12 15:49:30 deraadt Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_STACK_H 60 | #define HEADER_STACK_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | typedef struct stack_st { 67 | int num; 68 | char **data; 69 | int sorted; 70 | 71 | int num_alloc; 72 | int (*comp)(const void *, const void *); 73 | } _STACK; /* Use STACK_OF(...) instead */ 74 | 75 | #define M_sk_num(sk) ((sk) ? (sk)->num:-1) 76 | #define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) 77 | 78 | int sk_num(const _STACK *); 79 | void *sk_value(const _STACK *, int); 80 | 81 | void *sk_set(_STACK *, int, void *); 82 | 83 | _STACK *sk_new(int (*cmp)(const void *, const void *)); 84 | _STACK *sk_new_null(void); 85 | void sk_free(_STACK *); 86 | void sk_pop_free(_STACK *st, void (*func)(void *)); 87 | int sk_insert(_STACK *sk, void *data, int where); 88 | void *sk_delete(_STACK *st, int loc); 89 | void *sk_delete_ptr(_STACK *st, void *p); 90 | int sk_find(_STACK *st, void *data); 91 | int sk_find_ex(_STACK *st, void *data); 92 | int sk_push(_STACK *st, void *data); 93 | int sk_unshift(_STACK *st, void *data); 94 | void *sk_shift(_STACK *st); 95 | void *sk_pop(_STACK *st); 96 | void sk_zero(_STACK *st); 97 | int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *)))( 98 | const void *, const void *); 99 | _STACK *sk_dup(_STACK *st); 100 | void sk_sort(_STACK *st); 101 | int sk_is_sorted(const _STACK *st); 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/txt_db.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: txt_db.h,v 1.9 2014/07/10 22:45:58 jsing Exp $ */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_TXT_DB_H 60 | #define HEADER_TXT_DB_H 61 | 62 | #include 63 | 64 | #ifndef OPENSSL_NO_BIO 65 | #include 66 | #endif 67 | #include 68 | #include 69 | 70 | #define DB_ERROR_OK 0 71 | #define DB_ERROR_MALLOC 1 72 | #define DB_ERROR_INDEX_CLASH 2 73 | #define DB_ERROR_INDEX_OUT_OF_RANGE 3 74 | #define DB_ERROR_NO_INDEX 4 75 | #define DB_ERROR_INSERT_INDEX_CLASH 5 76 | 77 | #ifdef __cplusplus 78 | extern "C" { 79 | #endif 80 | 81 | typedef OPENSSL_STRING *OPENSSL_PSTRING; 82 | DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 83 | 84 | typedef struct txt_db_st { 85 | int num_fields; 86 | STACK_OF(OPENSSL_PSTRING) *data; 87 | LHASH_OF(OPENSSL_STRING) **index; 88 | int (**qual)(OPENSSL_STRING *); 89 | long error; 90 | long arg1; 91 | long arg2; 92 | OPENSSL_STRING *arg_row; 93 | } TXT_DB; 94 | 95 | #ifndef OPENSSL_NO_BIO 96 | TXT_DB *TXT_DB_read(BIO *in, int num); 97 | long TXT_DB_write(BIO *out, TXT_DB *db); 98 | #else 99 | TXT_DB *TXT_DB_read(char *in, int num); 100 | long TXT_DB_write(char *out, TXT_DB *db); 101 | #endif 102 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING *), 103 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); 104 | void TXT_DB_free(TXT_DB *db); 105 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value); 106 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/ui_compat.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: ui_compat.h,v 1.4 2014/06/12 15:49:31 deraadt Exp $ */ 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 3 | * project 2001. 4 | */ 5 | /* ==================================================================== 6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. All advertising materials mentioning features or use of this 21 | * software must display the following acknowledgment: 22 | * "This product includes software developed by the OpenSSL Project 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 24 | * 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26 | * endorse or promote products derived from this software without 27 | * prior written permission. For written permission, please contact 28 | * openssl-core@openssl.org. 29 | * 30 | * 5. Products derived from this software may not be called "OpenSSL" 31 | * nor may "OpenSSL" appear in their names without prior written 32 | * permission of the OpenSSL Project. 33 | * 34 | * 6. Redistributions of any form whatsoever must retain the following 35 | * acknowledgment: 36 | * "This product includes software developed by the OpenSSL Project 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * ==================================================================== 52 | * 53 | * This product includes cryptographic software written by Eric Young 54 | * (eay@cryptsoft.com). This product includes software written by Tim 55 | * Hudson (tjh@cryptsoft.com). 56 | * 57 | */ 58 | 59 | #ifndef HEADER_UI_COMPAT_H 60 | #define HEADER_UI_COMPAT_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* The following functions were previously part of the DES section, 70 | and are provided here for backward compatibility reasons. */ 71 | 72 | #define des_read_pw_string(b,l,p,v) \ 73 | _ossl_old_des_read_pw_string((b),(l),(p),(v)) 74 | #define des_read_pw(b,bf,s,p,v) \ 75 | _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) 76 | 77 | int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, int verify); 78 | int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt, int verify); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif 84 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: whrlpool.h,v 1.5 2014/07/10 22:45:58 jsing Exp $ */ 2 | 3 | #include 4 | 5 | #ifndef HEADER_WHRLPOOL_H 6 | #define HEADER_WHRLPOOL_H 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #define WHIRLPOOL_DIGEST_LENGTH (512/8) 15 | #define WHIRLPOOL_BBLOCK 512 16 | #define WHIRLPOOL_COUNTER (256/8) 17 | 18 | typedef struct { 19 | union { 20 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 21 | /* double q is here to ensure 64-bit alignment */ 22 | double q[WHIRLPOOL_DIGEST_LENGTH/sizeof(double)]; 23 | } H; 24 | unsigned char data[WHIRLPOOL_BBLOCK/8]; 25 | unsigned int bitoff; 26 | size_t bitlen[WHIRLPOOL_COUNTER/sizeof(size_t)]; 27 | } WHIRLPOOL_CTX; 28 | 29 | #ifndef OPENSSL_NO_WHIRLPOOL 30 | int WHIRLPOOL_Init (WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits); 33 | int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /C/SSL/include/openssl/x509_verify.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: x509_verify.h,v 1.2 2021/11/04 23:52:34 beck Exp $ */ 2 | /* 3 | * Copyright (c) 2020 Bob Beck 4 | * 5 | * Permission to use, copy, modify, and distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | #ifndef HEADER_X509_VERIFY_H 18 | #define HEADER_X509_VERIFY_H 19 | 20 | #ifdef LIBRESSL_INTERNAL 21 | struct x509_verify_ctx; 22 | struct x509_verify_cert_info; 23 | typedef struct x509_verify_ctx X509_VERIFY_CTX; 24 | 25 | X509_VERIFY_CTX *x509_verify_ctx_new(STACK_OF(X509) *roots); 26 | void x509_verify_ctx_free(struct x509_verify_ctx *ctx); 27 | 28 | int x509_verify_ctx_set_max_depth(X509_VERIFY_CTX *ctx, size_t max); 29 | int x509_verify_ctx_set_max_chains(X509_VERIFY_CTX *ctx, size_t max); 30 | int x509_verify_ctx_set_max_signatures(X509_VERIFY_CTX *ctx, size_t max); 31 | int x509_verify_ctx_set_purpose(X509_VERIFY_CTX *ctx, int purpose_id); 32 | int x509_verify_ctx_set_intermediates(X509_VERIFY_CTX *ctx, 33 | STACK_OF(X509) *intermediates); 34 | 35 | const char *x509_verify_ctx_error_string(X509_VERIFY_CTX *ctx); 36 | size_t x509_verify_ctx_error_depth(X509_VERIFY_CTX *ctx); 37 | 38 | STACK_OF(X509) *x509_verify_ctx_chain(X509_VERIFY_CTX *ctx, size_t chain); 39 | 40 | size_t x509_verify(X509_VERIFY_CTX *ctx, X509 *leaf, char *name); 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /C/SSL/include/pqueue.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: pqueue.h,v 1.4 2016/11/04 18:28:58 guenther Exp $ */ 2 | 3 | /* 4 | * DTLS implementation written by Nagendra Modadugu 5 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 6 | */ 7 | /* ==================================================================== 8 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in 19 | * the documentation and/or other materials provided with the 20 | * distribution. 21 | * 22 | * 3. All advertising materials mentioning features or use of this 23 | * software must display the following acknowledgment: 24 | * "This product includes software developed by the OpenSSL Project 25 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 26 | * 27 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 28 | * endorse or promote products derived from this software without 29 | * prior written permission. For written permission, please contact 30 | * openssl-core@OpenSSL.org. 31 | * 32 | * 5. Products derived from this software may not be called "OpenSSL" 33 | * nor may "OpenSSL" appear in their names without prior written 34 | * permission of the OpenSSL Project. 35 | * 36 | * 6. Redistributions of any form whatsoever must retain the following 37 | * acknowledgment: 38 | * "This product includes software developed by the OpenSSL Project 39 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 42 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 44 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 45 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 47 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 48 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 50 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 51 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52 | * OF THE POSSIBILITY OF SUCH DAMAGE. 53 | * ==================================================================== 54 | * 55 | * This product includes cryptographic software written by Eric Young 56 | * (eay@cryptsoft.com). This product includes software written by Tim 57 | * Hudson (tjh@cryptsoft.com). 58 | * 59 | */ 60 | 61 | #ifndef HEADER_PQUEUE_H 62 | #define HEADER_PQUEUE_H 63 | 64 | __BEGIN_HIDDEN_DECLS 65 | 66 | typedef struct _pqueue *pqueue; 67 | 68 | typedef struct _pitem { 69 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 70 | void *data; 71 | struct _pitem *next; 72 | } pitem; 73 | 74 | typedef struct _pitem *piterator; 75 | 76 | pitem *pitem_new(unsigned char *prio64be, void *data); 77 | void pitem_free(pitem *item); 78 | 79 | pqueue pqueue_new(void); 80 | void pqueue_free(pqueue pq); 81 | 82 | pitem *pqueue_insert(pqueue pq, pitem *item); 83 | pitem *pqueue_peek(pqueue pq); 84 | pitem *pqueue_pop(pqueue pq); 85 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); 86 | pitem *pqueue_iterator(pqueue pq); 87 | pitem *pqueue_next(piterator *iter); 88 | 89 | int pqueue_size(pqueue pq); 90 | 91 | __END_HIDDEN_DECLS 92 | 93 | #endif /* ! HEADER_PQUEUE_H */ 94 | -------------------------------------------------------------------------------- /C/SSL/include/tls.h: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: tls.h,v 1.62 2022/03/24 15:56:34 tb Exp $ */ 2 | /* 3 | * Copyright (c) 2014 Joel Sing 4 | * 5 | * Permission to use, copy, modify, and distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | #ifndef HEADER_TLS_H 19 | #define HEADER_TLS_H 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #ifdef _MSC_VER 26 | #ifndef LIBRESSL_INTERNAL 27 | #include 28 | typedef SSIZE_T ssize_t; 29 | #endif 30 | #endif 31 | 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | #define TLS_API 20200120 38 | 39 | #define TLS_PROTOCOL_TLSv1_0 (1 << 1) 40 | #define TLS_PROTOCOL_TLSv1_1 (1 << 2) 41 | #define TLS_PROTOCOL_TLSv1_2 (1 << 3) 42 | #define TLS_PROTOCOL_TLSv1_3 (1 << 4) 43 | 44 | #define TLS_PROTOCOL_TLSv1 \ 45 | (TLS_PROTOCOL_TLSv1_0|TLS_PROTOCOL_TLSv1_1|\ 46 | TLS_PROTOCOL_TLSv1_2|TLS_PROTOCOL_TLSv1_3) 47 | 48 | #define TLS_PROTOCOLS_ALL TLS_PROTOCOL_TLSv1 49 | #define TLS_PROTOCOLS_DEFAULT (TLS_PROTOCOL_TLSv1_2|TLS_PROTOCOL_TLSv1_3) 50 | 51 | #define TLS_WANT_POLLIN -2 52 | #define TLS_WANT_POLLOUT -3 53 | 54 | /* RFC 6960 Section 2.3 */ 55 | #define TLS_OCSP_RESPONSE_SUCCESSFUL 0 56 | #define TLS_OCSP_RESPONSE_MALFORMED 1 57 | #define TLS_OCSP_RESPONSE_INTERNALERROR 2 58 | #define TLS_OCSP_RESPONSE_TRYLATER 3 59 | #define TLS_OCSP_RESPONSE_SIGREQUIRED 4 60 | #define TLS_OCSP_RESPONSE_UNAUTHORIZED 5 61 | 62 | /* RFC 6960 Section 2.2 */ 63 | #define TLS_OCSP_CERT_GOOD 0 64 | #define TLS_OCSP_CERT_REVOKED 1 65 | #define TLS_OCSP_CERT_UNKNOWN 2 66 | 67 | /* RFC 5280 Section 5.3.1 */ 68 | #define TLS_CRL_REASON_UNSPECIFIED 0 69 | #define TLS_CRL_REASON_KEY_COMPROMISE 1 70 | #define TLS_CRL_REASON_CA_COMPROMISE 2 71 | #define TLS_CRL_REASON_AFFILIATION_CHANGED 3 72 | #define TLS_CRL_REASON_SUPERSEDED 4 73 | #define TLS_CRL_REASON_CESSATION_OF_OPERATION 5 74 | #define TLS_CRL_REASON_CERTIFICATE_HOLD 6 75 | #define TLS_CRL_REASON_REMOVE_FROM_CRL 8 76 | #define TLS_CRL_REASON_PRIVILEGE_WITHDRAWN 9 77 | #define TLS_CRL_REASON_AA_COMPROMISE 10 78 | 79 | #define TLS_MAX_SESSION_ID_LENGTH 32 80 | #define TLS_TICKET_KEY_SIZE 48 81 | 82 | struct tls; 83 | struct tls_config; 84 | 85 | typedef ssize_t (*tls_read_cb)(struct tls *_ctx, void *_buf, size_t _buflen, 86 | void *_cb_arg); 87 | typedef ssize_t (*tls_write_cb)(struct tls *_ctx, const void *_buf, 88 | size_t _buflen, void *_cb_arg); 89 | 90 | int tls_init(void); 91 | 92 | const char *tls_config_error(struct tls_config *_config); 93 | const char *tls_error(struct tls *_ctx); 94 | 95 | struct tls_config *tls_config_new(void); 96 | void tls_config_free(struct tls_config *_config); 97 | 98 | const char *tls_default_ca_cert_file(void); 99 | 100 | int tls_config_add_keypair_file(struct tls_config *_config, 101 | const char *_cert_file, const char *_key_file); 102 | int tls_config_add_keypair_mem(struct tls_config *_config, const uint8_t *_cert, 103 | size_t _cert_len, const uint8_t *_key, size_t _key_len); 104 | int tls_config_add_keypair_ocsp_file(struct tls_config *_config, 105 | const char *_cert_file, const char *_key_file, 106 | const char *_ocsp_staple_file); 107 | int tls_config_add_keypair_ocsp_mem(struct tls_config *_config, const uint8_t *_cert, 108 | size_t _cert_len, const uint8_t *_key, size_t _key_len, 109 | const uint8_t *_staple, size_t _staple_len); 110 | int tls_config_set_alpn(struct tls_config *_config, const char *_alpn); 111 | int tls_config_set_ca_file(struct tls_config *_config, const char *_ca_file); 112 | int tls_config_set_ca_path(struct tls_config *_config, const char *_ca_path); 113 | int tls_config_set_ca_mem(struct tls_config *_config, const uint8_t *_ca, 114 | size_t _len); 115 | int tls_config_set_cert_file(struct tls_config *_config, 116 | const char *_cert_file); 117 | int tls_config_set_cert_mem(struct tls_config *_config, const uint8_t *_cert, 118 | size_t _len); 119 | int tls_config_set_ciphers(struct tls_config *_config, const char *_ciphers); 120 | int tls_config_set_crl_file(struct tls_config *_config, const char *_crl_file); 121 | int tls_config_set_crl_mem(struct tls_config *_config, const uint8_t *_crl, 122 | size_t _len); 123 | int tls_config_set_dheparams(struct tls_config *_config, const char *_params); 124 | int tls_config_set_ecdhecurve(struct tls_config *_config, const char *_curve); 125 | int tls_config_set_ecdhecurves(struct tls_config *_config, const char *_curves); 126 | int tls_config_set_key_file(struct tls_config *_config, const char *_key_file); 127 | int tls_config_set_key_mem(struct tls_config *_config, const uint8_t *_key, 128 | size_t _len); 129 | int tls_config_set_keypair_file(struct tls_config *_config, 130 | const char *_cert_file, const char *_key_file); 131 | int tls_config_set_keypair_mem(struct tls_config *_config, const uint8_t *_cert, 132 | size_t _cert_len, const uint8_t *_key, size_t _key_len); 133 | int tls_config_set_keypair_ocsp_file(struct tls_config *_config, 134 | const char *_cert_file, const char *_key_file, const char *_staple_file); 135 | int tls_config_set_keypair_ocsp_mem(struct tls_config *_config, const uint8_t *_cert, 136 | size_t _cert_len, const uint8_t *_key, size_t _key_len, 137 | const uint8_t *_staple, size_t staple_len); 138 | int tls_config_set_ocsp_staple_mem(struct tls_config *_config, 139 | const uint8_t *_staple, size_t _len); 140 | int tls_config_set_ocsp_staple_file(struct tls_config *_config, 141 | const char *_staple_file); 142 | int tls_config_set_protocols(struct tls_config *_config, uint32_t _protocols); 143 | int tls_config_set_session_fd(struct tls_config *_config, int _session_fd); 144 | int tls_config_set_verify_depth(struct tls_config *_config, int _verify_depth); 145 | 146 | void tls_config_prefer_ciphers_client(struct tls_config *_config); 147 | void tls_config_prefer_ciphers_server(struct tls_config *_config); 148 | 149 | void tls_config_insecure_noverifycert(struct tls_config *_config); 150 | void tls_config_insecure_noverifyname(struct tls_config *_config); 151 | void tls_config_insecure_noverifytime(struct tls_config *_config); 152 | void tls_config_verify(struct tls_config *_config); 153 | 154 | void tls_config_ocsp_require_stapling(struct tls_config *_config); 155 | void tls_config_verify_client(struct tls_config *_config); 156 | void tls_config_verify_client_optional(struct tls_config *_config); 157 | 158 | void tls_config_clear_keys(struct tls_config *_config); 159 | int tls_config_parse_protocols(uint32_t *_protocols, const char *_protostr); 160 | 161 | int tls_config_set_session_id(struct tls_config *_config, 162 | const unsigned char *_session_id, size_t _len); 163 | int tls_config_set_session_lifetime(struct tls_config *_config, int _lifetime); 164 | int tls_config_add_ticket_key(struct tls_config *_config, uint32_t _keyrev, 165 | unsigned char *_key, size_t _keylen); 166 | 167 | struct tls *tls_client(void); 168 | struct tls *tls_server(void); 169 | int tls_configure(struct tls *_ctx, struct tls_config *_config); 170 | void tls_reset(struct tls *_ctx); 171 | void tls_free(struct tls *_ctx); 172 | 173 | int tls_accept_fds(struct tls *_ctx, struct tls **_cctx, int _fd_read, 174 | int _fd_write); 175 | int tls_accept_socket(struct tls *_ctx, struct tls **_cctx, int _socket); 176 | int tls_accept_cbs(struct tls *_ctx, struct tls **_cctx, 177 | tls_read_cb _read_cb, tls_write_cb _write_cb, void *_cb_arg); 178 | int tls_connect(struct tls *_ctx, const char *_host, const char *_port); 179 | int tls_connect_fds(struct tls *_ctx, int _fd_read, int _fd_write, 180 | const char *_servername); 181 | int tls_connect_servername(struct tls *_ctx, const char *_host, 182 | const char *_port, const char *_servername); 183 | int tls_connect_socket(struct tls *_ctx, int _s, const char *_servername); 184 | int tls_connect_cbs(struct tls *_ctx, tls_read_cb _read_cb, 185 | tls_write_cb _write_cb, void *_cb_arg, const char *_servername); 186 | int tls_handshake(struct tls *_ctx); 187 | ssize_t tls_read(struct tls *_ctx, void *_buf, size_t _buflen); 188 | ssize_t tls_write(struct tls *_ctx, const void *_buf, size_t _buflen); 189 | int tls_close(struct tls *_ctx); 190 | 191 | int tls_peer_cert_provided(struct tls *_ctx); 192 | int tls_peer_cert_contains_name(struct tls *_ctx, const char *_name); 193 | 194 | const char *tls_peer_cert_hash(struct tls *_ctx); 195 | const char *tls_peer_cert_issuer(struct tls *_ctx); 196 | const char *tls_peer_cert_subject(struct tls *_ctx); 197 | time_t tls_peer_cert_notbefore(struct tls *_ctx); 198 | time_t tls_peer_cert_notafter(struct tls *_ctx); 199 | const uint8_t *tls_peer_cert_chain_pem(struct tls *_ctx, size_t *_len); 200 | 201 | const char *tls_conn_alpn_selected(struct tls *_ctx); 202 | const char *tls_conn_cipher(struct tls *_ctx); 203 | int tls_conn_cipher_strength(struct tls *_ctx); 204 | const char *tls_conn_servername(struct tls *_ctx); 205 | int tls_conn_session_resumed(struct tls *_ctx); 206 | const char *tls_conn_version(struct tls *_ctx); 207 | 208 | uint8_t *tls_load_file(const char *_file, size_t *_len, char *_password); 209 | void tls_unload_file(uint8_t *_buf, size_t len); 210 | 211 | int tls_ocsp_process_response(struct tls *_ctx, const unsigned char *_response, 212 | size_t _size); 213 | int tls_peer_ocsp_cert_status(struct tls *_ctx); 214 | int tls_peer_ocsp_crl_reason(struct tls *_ctx); 215 | time_t tls_peer_ocsp_next_update(struct tls *_ctx); 216 | int tls_peer_ocsp_response_status(struct tls *_ctx); 217 | const char *tls_peer_ocsp_result(struct tls *_ctx); 218 | time_t tls_peer_ocsp_revocation_time(struct tls *_ctx); 219 | time_t tls_peer_ocsp_this_update(struct tls *_ctx); 220 | const char *tls_peer_ocsp_url(struct tls *_ctx); 221 | 222 | #ifdef __cplusplus 223 | } 224 | #endif 225 | 226 | #endif /* HEADER_TLS_H */ 227 | -------------------------------------------------------------------------------- /C/SSL/libressl.txt: -------------------------------------------------------------------------------- 1 | Download LibreSSL from https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ 2 | https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.3.3.tar.gz 3 | 4 | # cd libressl-3.3.3 5 | 6 | ================= 7 | LINUX COMPILATION 8 | ================= 9 | # ./configure --enable-libtls-only 10 | # make 11 | # mv tls/.libs/libtls.a to appropriate directory 12 | 13 | 14 | ================= 15 | MACOS COMPILATION 16 | ================= 17 | In macOS we need to build a fat library that contains both the arm64 code and the x86_64 code. 18 | Partial instructions from: 19 | https://www.f-ax.de/dev/2021/01/15/build-fat-macos-library.html 20 | and from the libressl.sh script 21 | 22 | 23 | MACOS ARM 24 | # ./configure --build=aarch64-apple-darwin --host=aarch64-apple-darwin22 --enable-libtls-only CFLAGS="-arch arm64" 25 | # make 26 | # mv tls/.libs/libtls.a libtls_arm64.a 27 | # make clean 28 | 29 | MACOS x86_64 30 | # ./configure --enable-libtls-only 31 | # make 32 | # mv tls/.libs/libtls.a libtls_x86_64.a 33 | 34 | MAC FAT 35 | # lipo -create libtls_x86_64.a libtls_arm64.a -output libtls.a 36 | 37 | MAC CHECK 38 | # lipo -info libtls.a 39 | 40 | 41 | =================== 42 | WINDOWS COMPILATION 43 | =================== 44 | To do 45 | 46 | 47 | ================= 48 | API DOCUMENTATION 49 | ================= 50 | https://github.com/bob-beck/libtls/blob/master/TUTORIAL.md 51 | https://gist.github.com/kinichiro/9ac1f6768d490bb3d9828e9ffac7d098 52 | https://github.com/daniloegea/libressl-tls-api-examples -------------------------------------------------------------------------------- /C/SSL/linux_64bit/libtls.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqlitecloud/sdk/5badb6741f52fd96068b8c6662835896855ad27f/C/SSL/linux_64bit/libtls.a -------------------------------------------------------------------------------- /C/SSL/macos_fat/libtls.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqlitecloud/sdk/5badb6741f52fd96068b8c6662835896855ad27f/C/SSL/macos_fat/libtls.a -------------------------------------------------------------------------------- /C/apple/Makefile: -------------------------------------------------------------------------------- 1 | SDKROOT ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk 2 | TARGET ?= macos 3 | LIBTLS = ./fat/libressl/$(TARGET) 4 | LIBTLS_LIB = $(LIBTLS)/lib/libtls.a 5 | LIBTLS_INC = $(LIBTLS)/include 6 | AR := ar 7 | CC ?= /usr/bin/clang -target arm64-apple-darwin -isysroot $(SDKROOT) 8 | INCLUDES = -I../ -I$(LIBTLS_INC) 9 | OPTIONS := -Wno-macro-redefined -Wno-shift-negative-value -O2 -pipe -no-cpp-precomp -Wall -fno-strict-aliasing -fno-strict-overflow -fstack-protector-strong -Qunused-arguments -Wno-pointer-sign 10 | CFLAGS ?= -arch arm64 11 | LDFLAGS ;= -lpthread 12 | LIBFLAGS ?= 13 | 14 | all: libsqcloud.a 15 | 16 | lz4.o: ../lz4.c ../lz4.h 17 | $(CC) $(OPTIONS) $(CFLAGS) $(INCLUDES) ../lz4.c -c -o lz4.o 18 | 19 | sqcloud.o: ../sqcloud.c ../sqcloud.h 20 | $(CC) $(OPTIONS) $(CFLAGS) $(INCLUDES) ../sqcloud.c -c -o sqcloud.o 21 | 22 | libsqcloud.a: lz4.o sqcloud.o 23 | $(AR) rcs libsqcloud-tmp.a *.o 24 | libtool -static -o libsqcloud.a libsqcloud-tmp.a $(LIBTLS_LIB) 25 | 26 | cli: libsqcloud.a ../cli/linenoise.c ../cli/linenoise.h ../cli/main.c 27 | $(CC) $(OPTIONS) $(CFLAGS) $(INCLUDES) ../cli/*.c libsqcloud.a -o sqlitecloud-cli ${LIBFLAGS} ${LDFLAGS} 28 | 29 | clean: 30 | rm -rf *.o *.a *.so *.dylib sqlitecloud-cli 31 | 32 | buildclean: 33 | rm -rf build Fat output 34 | 35 | .PHONY: all cli clean buildclean 36 | -------------------------------------------------------------------------------- /C/apple/README.md: -------------------------------------------------------------------------------- 1 | # libsqcloud XCFramework for iOS, macOS & Catalyst 2 | 3 | A script to compile libsqcloud (C SDK for SQLite Cloud) and its dependencies (libtls) to an XCFramework supporting the latest Apple OS versions 4 | 5 | Instructions: 6 | Build: 7 | ``` 8 | bash build-apple.sh 9 | ``` 10 | 11 | The resulting XCFrameworks `libsqcloud.xcframework` will be saved in the "output" directory. 12 | The script also compiles the libtls library using the `libressl.sh` script, if needed, and includes it into the libsqcloud.a files. 13 | -------------------------------------------------------------------------------- /C/cli/linenoise.h: -------------------------------------------------------------------------------- 1 | /* linenoise.h -- VERSION 1.0 2 | * 3 | * Guerrilla line editing library against the idea that a line editing lib 4 | * needs to be 20,000 lines of C code. 5 | * 6 | * See linenoise.c for more information. 7 | * 8 | * ------------------------------------------------------------------------ 9 | * 10 | * Copyright (c) 2010-2023, Salvatore Sanfilippo 11 | * Copyright (c) 2010-2013, Pieter Noordhuis 12 | * 13 | * All rights reserved. 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions are 17 | * met: 18 | * 19 | * * Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * 22 | * * Redistributions in binary form must reproduce the above copyright 23 | * notice, this list of conditions and the following disclaimer in the 24 | * documentation and/or other materials provided with the distribution. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | 39 | #ifndef __LINENOISE_H 40 | #define __LINENOISE_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #include /* For size_t. */ 47 | 48 | extern char *linenoiseEditMore; 49 | 50 | /* The linenoiseState structure represents the state during line editing. 51 | * We pass this state to functions implementing specific editing 52 | * functionalities. */ 53 | struct linenoiseState { 54 | int in_completion; /* The user pressed TAB and we are now in completion 55 | * mode, so input is handled by completeLine(). */ 56 | size_t completion_idx; /* Index of next completion to propose. */ 57 | int ifd; /* Terminal stdin file descriptor. */ 58 | int ofd; /* Terminal stdout file descriptor. */ 59 | char *buf; /* Edited line buffer. */ 60 | size_t buflen; /* Edited line buffer size. */ 61 | const char *prompt; /* Prompt to display. */ 62 | size_t plen; /* Prompt length. */ 63 | size_t pos; /* Current cursor position. */ 64 | size_t oldpos; /* Previous refresh cursor position. */ 65 | size_t len; /* Current edited line length. */ 66 | size_t cols; /* Number of columns in terminal. */ 67 | size_t oldrows; /* Rows used by last refrehsed line (multiline mode) */ 68 | int history_index; /* The history index we are currently editing. */ 69 | }; 70 | 71 | typedef struct linenoiseCompletions { 72 | size_t len; 73 | char **cvec; 74 | } linenoiseCompletions; 75 | 76 | /* Non blocking API. */ 77 | int linenoiseEditStart(struct linenoiseState *l, int stdin_fd, int stdout_fd, char *buf, size_t buflen, const char *prompt); 78 | char *linenoiseEditFeed(struct linenoiseState *l); 79 | void linenoiseEditStop(struct linenoiseState *l); 80 | void linenoiseHide(struct linenoiseState *l); 81 | void linenoiseShow(struct linenoiseState *l); 82 | 83 | /* Blocking API. */ 84 | char *linenoise(const char *prompt); 85 | void linenoiseFree(void *ptr); 86 | 87 | /* Completion API. */ 88 | typedef void(linenoiseCompletionCallback)(const char *, linenoiseCompletions *); 89 | typedef char*(linenoiseHintsCallback)(const char *, int *color, int *bold); 90 | typedef void(linenoiseFreeHintsCallback)(void *); 91 | void linenoiseSetCompletionCallback(linenoiseCompletionCallback *); 92 | void linenoiseSetHintsCallback(linenoiseHintsCallback *); 93 | void linenoiseSetFreeHintsCallback(linenoiseFreeHintsCallback *); 94 | void linenoiseAddCompletion(linenoiseCompletions *, const char *); 95 | 96 | /* History API. */ 97 | int linenoiseHistoryAdd(const char *line); 98 | int linenoiseHistorySetMaxLen(int len); 99 | int linenoiseHistorySave(const char *filename); 100 | int linenoiseHistoryLoad(const char *filename); 101 | 102 | /* Other utilities. */ 103 | void linenoiseClearScreen(void); 104 | void linenoiseSetMultiLine(int ml); 105 | void linenoisePrintKeyCodes(void); 106 | void linenoiseMaskModeEnable(void); 107 | void linenoiseMaskModeDisable(void); 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | #endif /* __LINENOISE_H */ 114 | -------------------------------------------------------------------------------- /C/sqcloud_private.h: -------------------------------------------------------------------------------- 1 | // 2 | // sqcloud_private.h 3 | // sqlitecloud 4 | // 5 | // Created by Marco Bambini on 28/05/21. 6 | // Copyright © 2021 SQLite Cloud Inc. All rights reserved. 7 | // 8 | 9 | #ifndef __SQCLOUD_PRIVATE__ 10 | #define __SQCLOUD_PRIVATE__ 11 | 12 | #include "sqcloud.h" 13 | 14 | #define SQCloudExecBuffer _reserved0 15 | #define SQCloudForwardExec _reserved1 16 | #define SQCloudSetClientUUID _reserved2 17 | #define sqcloud_parse_buffer _reserved3 18 | #define sqcloud_parse_number _reserved4 19 | #define sqcloud_result_is_chunk _reserved5 20 | #define SQCloudTransferDatabase _reserved8 21 | #define sqcloud_parse_type _reserved9 22 | #define sqcloud_parse_value _reserved10 23 | #define sqcloud_parse_array_value _reserved11 24 | #define sqcloud_parse_array_count _reserved12 25 | #define SQCloudDownloadDatabaseInternal _reserved13 26 | 27 | SQCloudResult *SQCloudExecBuffer (SQCloudConnection *connection, const char *buffer, size_t blen, bool compute_header); 28 | bool SQCloudForwardExec(SQCloudConnection *connection, const char *command, size_t len, bool compute_header, bool (*forward_cb) (char *buffer, size_t blen, void *xdata, void *xdata2), void *xdata, void *xdata2); 29 | SQCloudResult *SQCloudSetClientUUID (SQCloudConnection *connection, const char *UUID); 30 | bool SQCloudTransferDatabase (SQCloudConnection *connection, const char *dbname, const char *key, uint64_t snapshotid, bool isinternaldb, void *xdata, int64_t dbsize, int (*xCallback)(void *xdata, void *buffer, uint32_t *blen, int64_t ntot, int64_t nprogress)); 31 | bool SQCloudDownloadDatabaseInternal (SQCloudConnection *connection, const char *dbname, void *xdata, 32 | int (*xCallback)(void *xdata, const void *buffer, uint32_t blen, int64_t ntot, int64_t nprogress), uint64_t *raft_index, bool ifexists); 33 | 34 | SQCloudResult *sqcloud_parse_buffer (char *buffer, uint32_t blen, uint32_t cstart, SQCloudResult *chunk); 35 | uint32_t sqcloud_parse_number (char *buffer, uint32_t blen, uint32_t *cstart); 36 | char *sqcloud_parse_value (char *buffer, uint32_t *len, uint32_t *cellsize); 37 | char *sqcloud_parse_array_value(char *buffer, uint32_t blen, uint32_t index, uint32_t *len, uint32_t *cellsize, uint32_t *pos, int *type, SQCLOUD_INTERNAL_ERRCODE *errcode); 38 | int32_t sqcloud_parse_array_count(char *buffer, uint32_t blen); 39 | bool sqcloud_result_is_chunk (SQCloudResult *res); 40 | int sqcloud_parse_type (char *buffer); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SQLite Cloud SDK 2 | 3 | Official SDK repository for SQLite Cloud databases and nodes. 4 | --------------------------------------------------------------------------------