├── .github
└── workflows
│ └── pr_notification.yml
├── .gitignore
├── LICENSE
├── QRCode
├── pingout.cpp
├── pngout.hpp
├── qr.png.cpp
├── qr.png.h
├── qrcode.cpp
└── qrcode.hpp
├── README.md
├── Security.hpp
├── auth.cpp
├── auth.hpp
├── curl
├── Makefile.am
├── Makefile.in
├── curl.h
├── curlver.h
├── easy.h
├── header.h
├── libcurl.lib
├── mprintf.h
├── multi.h
├── options.h
├── stdcheaders.h
├── system.h
├── typecheck-gcc.h
├── urlapi.h
├── websockets.h
└── zlib.lib
├── includes.hpp
├── killEmulator.hpp
├── lazy_importer.hpp
├── library.sln
├── library.vcxproj
├── library.vcxproj.filters
├── library.vcxproj.user
├── libsodium
├── libsodium.lib
├── sodium.h
└── sodium
│ ├── core.h
│ ├── crypto_aead_aegis128l.h
│ ├── crypto_aead_aegis256.h
│ ├── crypto_aead_aes256gcm.h
│ ├── crypto_aead_chacha20poly1305.h
│ ├── crypto_aead_xchacha20poly1305.h
│ ├── crypto_auth.h
│ ├── crypto_auth_hmacsha256.h
│ ├── crypto_auth_hmacsha512.h
│ ├── crypto_auth_hmacsha512256.h
│ ├── crypto_box.h
│ ├── crypto_box_curve25519xchacha20poly1305.h
│ ├── crypto_box_curve25519xsalsa20poly1305.h
│ ├── crypto_core_ed25519.h
│ ├── crypto_core_hchacha20.h
│ ├── crypto_core_hsalsa20.h
│ ├── crypto_core_ristretto255.h
│ ├── crypto_core_salsa20.h
│ ├── crypto_core_salsa2012.h
│ ├── crypto_core_salsa208.h
│ ├── crypto_generichash.h
│ ├── crypto_generichash_blake2b.h
│ ├── crypto_hash.h
│ ├── crypto_hash_sha256.h
│ ├── crypto_hash_sha512.h
│ ├── crypto_kdf.h
│ ├── crypto_kdf_blake2b.h
│ ├── crypto_kdf_hkdf_sha256.h
│ ├── crypto_kdf_hkdf_sha512.h
│ ├── crypto_kx.h
│ ├── crypto_onetimeauth.h
│ ├── crypto_onetimeauth_poly1305.h
│ ├── crypto_pwhash.h
│ ├── crypto_pwhash_argon2i.h
│ ├── crypto_pwhash_argon2id.h
│ ├── crypto_pwhash_scryptsalsa208sha256.h
│ ├── crypto_scalarmult.h
│ ├── crypto_scalarmult_curve25519.h
│ ├── crypto_scalarmult_ed25519.h
│ ├── crypto_scalarmult_ristretto255.h
│ ├── crypto_secretbox.h
│ ├── crypto_secretbox_xchacha20poly1305.h
│ ├── crypto_secretbox_xsalsa20poly1305.h
│ ├── crypto_secretstream_xchacha20poly1305.h
│ ├── crypto_shorthash.h
│ ├── crypto_shorthash_siphash24.h
│ ├── crypto_sign.h
│ ├── crypto_sign_ed25519.h
│ ├── crypto_sign_edwards25519sha512batch.h
│ ├── crypto_stream.h
│ ├── crypto_stream_chacha20.h
│ ├── crypto_stream_salsa20.h
│ ├── crypto_stream_salsa2012.h
│ ├── crypto_stream_salsa208.h
│ ├── crypto_stream_xchacha20.h
│ ├── crypto_stream_xsalsa20.h
│ ├── crypto_verify_16.h
│ ├── crypto_verify_32.h
│ ├── crypto_verify_64.h
│ ├── export.h
│ ├── randombytes.h
│ ├── randombytes_internal_random.h
│ ├── randombytes_sysrandom.h
│ ├── runtime.h
│ ├── utils.h
│ └── version.h
├── nlohmann
├── adl_serializer.hpp
├── byte_container_with_subtype.hpp
├── detail
│ ├── conversions
│ │ ├── from_json.hpp
│ │ ├── to_chars.hpp
│ │ └── to_json.hpp
│ ├── exceptions.hpp
│ ├── hash.hpp
│ ├── input
│ │ ├── binary_reader.hpp
│ │ ├── input_adapters.hpp
│ │ ├── json_sax.hpp
│ │ ├── lexer.hpp
│ │ ├── parser.hpp
│ │ └── position_t.hpp
│ ├── iterators
│ │ ├── internal_iterator.hpp
│ │ ├── iter_impl.hpp
│ │ ├── iteration_proxy.hpp
│ │ ├── iterator_traits.hpp
│ │ ├── json_reverse_iterator.hpp
│ │ └── primitive_iterator.hpp
│ ├── json_pointer.hpp
│ ├── json_ref.hpp
│ ├── macro_scope.hpp
│ ├── macro_unscope.hpp
│ ├── meta
│ │ ├── cpp_future.hpp
│ │ ├── detected.hpp
│ │ ├── is_sax.hpp
│ │ ├── type_traits.hpp
│ │ └── void_t.hpp
│ ├── output
│ │ ├── binary_writer.hpp
│ │ ├── output_adapters.hpp
│ │ └── serializer.hpp
│ └── value_t.hpp
├── json.hpp
├── json_fwd.hpp
├── ordered_map.hpp
└── thirdparty
│ └── hedley
│ ├── hedley.hpp
│ └── hedley_undef.hpp
├── utils.cpp
├── utils.hpp
└── xorstr.hpp
/.github/workflows/pr_notification.yml:
--------------------------------------------------------------------------------
1 | name: Pull Request Notification
2 |
3 | on:
4 | pull_request_target:
5 | types:
6 | - opened
7 |
8 | jobs:
9 | notify:
10 | uses: KeyAuth/.github/.github/workflows/pr_notification_global.yml@main
11 | secrets:
12 | DISCORD_PR: ${{ secrets.DISCORD_PR }}
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Elastic License 2.0
2 |
3 | URL: https://www.elastic.co/licensing/elastic-license
4 |
5 | ## Acceptance
6 |
7 | By using the software, you agree to all of the terms and conditions below.
8 |
9 | ## Copyright License
10 |
11 | The licensor grants you a non-exclusive, royalty-free, worldwide,
12 | non-sublicensable, non-transferable license to use, copy, distribute, make
13 | available, and prepare derivative works of the software, in each case subject to
14 | the limitations and conditions below.
15 |
16 | ## Limitations
17 |
18 | You may not provide the software to third parties as a hosted or managed
19 | service, where the service provides users with access to any substantial set of
20 | the features or functionality of the software.
21 |
22 | You may not move, change, disable, or circumvent the license key functionality
23 | in the software, and you may not remove or obscure any functionality in the
24 | software that is protected by the license key.
25 |
26 | You may not alter, remove, or obscure any licensing, copyright, or other notices
27 | of the licensor in the software. Any use of the licensor’s trademarks is subject
28 | to applicable law.
29 |
30 | ## Patents
31 |
32 | The licensor grants you a license, under any patent claims the licensor can
33 | license, or becomes able to license, to make, have made, use, sell, offer for
34 | sale, import and have imported the software, in each case subject to the
35 | limitations and conditions in this license. This license does not cover any
36 | patent claims that you cause to be infringed by modifications or additions to
37 | the software. If you or your company make any written claim that the software
38 | infringes or contributes to infringement of any patent, your patent license for
39 | the software granted under these terms ends immediately. If your company makes
40 | such a claim, your patent license ends immediately for work on behalf of your
41 | company.
42 |
43 | ## Notices
44 |
45 | You must ensure that anyone who gets a copy of any part of the software from you
46 | also gets a copy of these terms.
47 |
48 | If you modify the software, you must include in any modified copies of the
49 | software prominent notices stating that you have modified the software.
50 |
51 | ## No Other Rights
52 |
53 | These terms do not imply any licenses other than those expressly granted in
54 | these terms.
55 |
56 | ## Termination
57 |
58 | If you use the software in violation of these terms, such use is not licensed,
59 | and your licenses will automatically terminate. If the licensor provides you
60 | with a notice of your violation, and you cease all violation of this license no
61 | later than 30 days after you receive that notice, your licenses will be
62 | reinstated retroactively. However, if you violate these terms after such
63 | reinstatement, any additional violation of these terms will cause your licenses
64 | to terminate automatically and permanently.
65 |
66 | ## No Liability
67 |
68 | *As far as the law allows, the software comes as is, without any warranty or
69 | condition, and the licensor will not be liable to you for any damages arising
70 | out of these terms or the use or nature of the software, under any kind of
71 | legal claim.*
72 |
73 | ## Definitions
74 |
75 | The **licensor** is the entity offering these terms, and the **software** is the
76 | software the licensor makes available under these terms, including any portion
77 | of it.
78 |
79 | **you** refers to the individual or entity agreeing to these terms.
80 |
81 | **your company** is any legal entity, sole proprietorship, or other kind of
82 | organization that you work for, plus all organizations that have control over,
83 | are under the control of, or are under common control with that
84 | organization. **control** means ownership of substantially all the assets of an
85 | entity, or the power to direct its management and policies by vote, contract, or
86 | otherwise. Control can be direct or indirect.
87 |
88 | **your licenses** are all the licenses granted to you for the software under
89 | these terms.
90 |
91 | **use** means anything you do with the software requiring one of your licenses.
92 |
93 | **trademark** means trademarks, service marks, and similar rights.
94 |
--------------------------------------------------------------------------------
/QRCode/pngout.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Tiny PNG Output (C++)
3 | *
4 | * Copyright (c) 2018 Project Nayuki
5 | * https://www.nayuki.io/page/tiny-png-output
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program (see COPYING.txt and COPYING.LESSER.txt).
19 | * If not, see .
20 | */
21 |
22 | #pragma once
23 |
24 | #include
25 | #include
26 | #include
27 |
28 |
29 | /*
30 | * Takes image pixel data in raw RGB8.8.8 format and writes a PNG file to a byte output stream.
31 | */
32 | class TinyPngOut final {
33 |
34 | /*---- Fields ----*/
35 |
36 | // Immutable configuration
37 | private: std::uint32_t width; // Measured in pixels
38 | private: std::uint32_t height; // Measured in pixels
39 | private: std::uint32_t lineSize; // Measured in bytes, equal to (width * 3 + 1)
40 |
41 | // Running state
42 | private: std::ostream &output;
43 | private: std::uint32_t positionX; // Next byte index in current line
44 | private: std::uint32_t positionY; // Line index of next byte
45 | private: std::uint32_t uncompRemain; // Number of uncompressed bytes remaining
46 | private: std::uint16_t deflateFilled; // Bytes filled in the current block (0 <= n < DEFLATE_MAX_BLOCK_SIZE)
47 | private: std::uint32_t crc; // Primarily for IDAT chunk
48 | private: std::uint32_t adler; // For DEFLATE data within IDAT
49 |
50 |
51 |
52 | /*---- Public constructor and method ----*/
53 |
54 | /*
55 | * Creates a PNG writer with the given width and height (both non-zero) and byte output stream.
56 | * TinyPngOut will leave the output stream still open once it finishes writing the PNG file data.
57 | * Throws an exception if the dimensions exceed certain limits (e.g. w * h > 700 million).
58 | */
59 | public: explicit TinyPngOut(std::uint32_t w, std::uint32_t h, std::ostream &out);
60 |
61 |
62 | /*
63 | * Writes 'count' pixels from the given array to the output stream. This reads count*3
64 | * bytes from the array. Pixels are presented from top to bottom, left to right, and with
65 | * subpixels in RGB order. This object keeps track of how many pixels were written and
66 | * various position variables. It is an error to write more pixels in total than width*height.
67 | * Once exactly width*height pixels have been written with this TinyPngOut object,
68 | * there are no more valid operations on the object and it should be discarded.
69 | */
70 | public: void write(const std::uint8_t pixels[], size_t count);
71 |
72 |
73 |
74 | /*---- Private checksum methods ----*/
75 |
76 | // Reads the 'crc' field and updates its value based on the given array of new data.
77 | private: void crc32(const std::uint8_t data[], size_t len);
78 |
79 |
80 | // Reads the 'adler' field and updates its value based on the given array of new data.
81 | private: void adler32(const std::uint8_t data[], size_t len);
82 |
83 |
84 |
85 | /*---- Private utility members ----*/
86 |
87 | private: template
88 | void write(const std::uint8_t (&data)[N]) {
89 | output.write(reinterpret_cast(data), sizeof(data));
90 | }
91 |
92 |
93 | private: static void putBigUint32(std::uint32_t val, std::uint8_t array[4]);
94 |
95 |
96 | private: static constexpr std::uint16_t DEFLATE_MAX_BLOCK_SIZE = 65535;
97 |
98 | };
99 |
--------------------------------------------------------------------------------
/QRCode/qr.png.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by remy on 07-06-20.
3 | //
4 |
5 | #ifndef QR_TO_PNG_H
6 | #define QR_TO_PNG_H
7 |
8 | /* If your compiler is recent enough,
9 | * you don't need to include '::experimental::',
10 | * you can just include "::filesystem". The below
11 | * code makes both work, accessible at 'fs::'. */
12 | #if defined(__GNUC__) && __GNUC__ < 9
13 | #include
14 | namespace fs = std::experimental::filesystem;
15 | #else
16 | #include
17 | namespace fs = std::filesystem;
18 | #endif
19 |
20 | #include "QrCode.hpp"
21 | #include "qrcode.hpp"
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | class QrToPng {
28 | public:
29 | /**
30 | * Gives an object containing all the data to create the QR code. When @writeToPNG() is called,
31 | * the actual file is constructed and written.
32 | * The image is scaled to fit in the given size as much as possible relative to the QR code
33 | * size.
34 | * @param fileName relative or absolute filename to write image to. Relative will be in CWD.
35 | * @param imgSize The height and width of the image. Image is square, so will be width and height.
36 | * @param minModulePixelSize How many pixels big should a qr module be (a white or black dot)?
37 | * @param text The text to encode in the QR code.
38 | * @param overwriteExistingFile Overwrite if a file with @fileName already exists?
39 | * @param ecc error correction (low,mid,high).
40 | */
41 | QrToPng(std::string fileName, int imgSize, int minModulePixelSize, std::string text,
42 | bool overwriteExistingFile, qrcodegen::QrCode::Ecc ecc);
43 |
44 | /** Writes a QrToPng object to a png file at @_fileName.
45 | * @return true if file could be written, false if file could not be written */
46 | bool writeToPNG();
47 |
48 | private:
49 | std::string _fileName;
50 | int _size;
51 | int _minModulePixelSize;
52 | std::string _text;
53 | bool _overwriteExistingFile;
54 | qrcodegen::QrCode::Ecc _ecc;
55 |
56 | /** Writes the PNG file. Constructs a vector with
57 | * each element being a row of RGB 8.8.8 pixels, the
58 | * format is geared towards the tinypngoutput library.
59 | * @param qrData the code returned by the qrcodegen library
60 | * @return true if file could be written, false if file could not be written */
61 | [[nodiscard]] bool _writeToPNG(const qrcodegen::QrCode &qrData) const;
62 |
63 | /* returns the width/height of the image based on the max image size
64 | * and qr width. Ex. If the max img size is 90, the qr code size 29
65 | * the qr module pixel size will be 3, the image size will be 3*29=87. */
66 | [[nodiscard]] uint32_t _imgSize(const qrcodegen::QrCode &qrData) const;
67 |
68 | [[nodiscard]] uint32_t _imgSizeWithBorder(const qrcodegen::QrCode &qrData) const;
69 | };
70 |
71 | #endif //QR_TO_PNG_H
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # keyauth-cpp-library : Please star 🌟
2 | KeyAuth C++ Library
3 |
4 | This is the source code of the library_x64.lib file from https://github.com/KeyAuth/KeyAuth-CPP-Example
5 |
6 | Multi Support : x86/x64
7 |
8 | ## **Bugs**
9 |
10 | If you are using our example with no significant changes, and you are having problems, please Report Bug here https://keyauth.cc/app/?page=forms
11 |
12 | However, we do **NOT** provide support for adding KeyAuth to your project. If you can't figure this out you should use Google or YouTube to learn more about the programming language you want to sell a program in.
13 |
14 | ## Different Architectures
15 | x86 :
16 |
17 | 1- Compile libcurl can be downloaded from curl.se and compiled by x86 Native Tools (Visual Studio Tools)
18 |
19 | 2- Lib Configuration -> General -> C++ Language Standard -> ISO C++17 Standard (/std:c++17)
20 |
21 | 3- Lib Configuration -> Advanced -> Character Set -> Multi-Byte Character Set
22 |
23 | 4- Lib Configuration -> Preprocessor definiton for CURL -> CURL_STATICLIB
24 |
25 | ## **What is KeyAuth?**
26 |
27 | KeyAuth is an Open source authentication system with cloud hosting plans as well. Client SDKs available for [C#](https://github.com/KeyAuth/KeyAuth-CSHARP-Example), [C++](https://github.com/KeyAuth/KeyAuth-CPP-Example), [Python](https://github.com/KeyAuth/KeyAuth-Python-Example), [Java](https://github.com/KeyAuth-Archive/KeyAuth-JAVA-api), [JavaScript](https://github.com/mazkdevf/KeyAuth-JS-Example), [VB.NET](https://github.com/KeyAuth/KeyAuth-VB-Example), [PHP](https://github.com/KeyAuth/KeyAuth-PHP-Example), [Rust](https://github.com/KeyAuth/KeyAuth-Rust-Example), [Go](https://github.com/mazkdevf/KeyAuth-Go-Example), [Lua](https://github.com/mazkdevf/KeyAuth-Lua-Examples), [Ruby](https://github.com/mazkdevf/KeyAuth-Ruby-Example), and [Perl](https://github.com/mazkdevf/KeyAuth-Perl-Example). KeyAuth has several unique features such as memory streaming, webhook function where you can send requests to API without leaking the API, discord webhook notifications, ban the user securely through the application at your discretion. Feel free to join https://t.me/keyauth if you have questions or suggestions.
28 |
29 | > [!TIP]
30 | > https://vaultcord.com FREE Discord bot to Backup server, members, channels, messages & more. Custom verify page, block alt accounts, VPNs & more.
31 |
32 | ## Copyright License
33 |
34 | KeyAuth is licensed under **Elastic License 2.0**
35 |
36 | * You may not provide the software to third parties as a hosted or managed
37 | service, where the service provides users with access to any substantial set of
38 | the features or functionality of the software.
39 |
40 | * You may not move, change, disable, or circumvent the license key functionality
41 | in the software, and you may not remove or obscure any functionality in the
42 | software that is protected by the license key.
43 |
44 | * You may not alter, remove, or obscure any licensing, copyright, or other notices
45 | of the licensor in the software. Any use of the licensor’s trademarks is subject
46 | to applicable law.
47 |
48 | Thank you for your compliance, we work hard on the development of KeyAuth and do not appreciate our copyright being infringed.
49 |
--------------------------------------------------------------------------------
/Security.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | // code submitted in pull request from https://github.com/sbtoonz, authored by KeePassXC https://github.com/keepassxreboot/keepassxc/blob/dab7047113c4ad4ffead944d5c4ebfb648c1d0b0/src/core/Bootstrap.cpp#L121
9 | inline bool LockMemAccess()
10 | {
11 | bool bSuccess = false;
12 | // Process token and user
13 | HANDLE hToken = nullptr;
14 | PTOKEN_USER pTokenUser = nullptr;
15 | DWORD cbBufferSize = 0;
16 |
17 | // Access control list
18 | PACL pACL = nullptr;
19 | DWORD cbACL = 0;
20 |
21 | // Open the access token associated with the calling process
22 | if (!OpenProcessToken(
23 | GetCurrentProcess(),
24 | TOKEN_QUERY,
25 | &hToken
26 | )) {
27 | goto Cleanup;
28 | }
29 |
30 | // Retrieve the token information in a TOKEN_USER structure
31 | GetTokenInformation(
32 | hToken,
33 | TokenUser, // request for a TOKEN_USER structure
34 | nullptr,
35 | 0,
36 | &cbBufferSize
37 | );
38 |
39 | pTokenUser = static_cast(malloc(cbBufferSize));
40 | if (pTokenUser == nullptr) {
41 | goto Cleanup;
42 | }
43 |
44 | if (!GetTokenInformation(
45 | hToken,
46 | TokenUser,
47 | pTokenUser,
48 | cbBufferSize,
49 | &cbBufferSize
50 | )) {
51 | goto Cleanup;
52 | }
53 |
54 | if (!IsValidSid(pTokenUser->User.Sid)) {
55 | goto Cleanup;
56 | }
57 |
58 | // Calculate the amount of memory that must be allocated for the DACL
59 | cbACL = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(pTokenUser->User.Sid);
60 |
61 | // Create and initialize an ACL
62 | pACL = static_cast(malloc(cbACL));
63 | if (pACL == nullptr) {
64 | goto Cleanup;
65 | }
66 |
67 | if (!InitializeAcl(pACL, cbACL, ACL_REVISION)) {
68 | goto Cleanup;
69 | }
70 |
71 | // Add allowed access control entries, everything else is denied
72 | if (!AddAccessAllowedAce(
73 | pACL,
74 | ACL_REVISION,
75 | SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE, // same as protected process
76 | pTokenUser->User.Sid // pointer to the trustee's SID
77 | )) {
78 | goto Cleanup;
79 | }
80 |
81 | // Set discretionary access control list
82 | bSuccess = ERROR_SUCCESS == SetSecurityInfo(
83 | GetCurrentProcess(), // object handle
84 | SE_KERNEL_OBJECT, // type of object
85 | DACL_SECURITY_INFORMATION, // change only the objects DACL
86 | nullptr, nullptr, // do not change owner or group
87 | pACL, // DACL specified
88 | nullptr // do not change SACL
89 | );
90 |
91 | Cleanup:
92 |
93 | if (pACL != nullptr) {
94 | free(pACL);
95 |
96 | }
97 | if (pTokenUser != nullptr) {
98 | free(pTokenUser);
99 |
100 | }
101 | if (hToken != nullptr) {
102 | CloseHandle(hToken);
103 |
104 | }
105 | return bSuccess;
106 | }
--------------------------------------------------------------------------------
/curl/Makefile.am:
--------------------------------------------------------------------------------
1 | #***************************************************************************
2 | # _ _ ____ _
3 | # Project ___| | | | _ \| |
4 | # / __| | | | |_) | |
5 | # | (__| |_| | _ <| |___
6 | # \___|\___/|_| \_\_____|
7 | #
8 | # Copyright (C) 1998 - 2019, Daniel Stenberg, , et al.
9 | #
10 | # This software is licensed as described in the file COPYING, which
11 | # you should have received as part of this distribution. The terms
12 | # are also available at https://curl.haxx.se/docs/copyright.html.
13 | #
14 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 | # copies of the Software, and permit persons to whom the Software is
16 | # furnished to do so, under the terms of the COPYING file.
17 | #
18 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 | # KIND, either express or implied.
20 | #
21 | ###########################################################################
22 | pkginclude_HEADERS = \
23 | curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
24 | typecheck-gcc.h system.h urlapi.h
25 |
26 | pkgincludedir= $(includedir)/curl
27 |
28 | CHECKSRC = $(CS_$(V))
29 | CS_0 = @echo " RUN " $@;
30 | CS_1 =
31 | CS_ = $(CS_0)
32 |
33 | checksrc:
34 | $(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
35 |
36 | if CURLDEBUG
37 | # for debug builds, we scan the sources on all regular make invokes
38 | all-local: checksrc
39 | endif
40 |
--------------------------------------------------------------------------------
/curl/curlver.h:
--------------------------------------------------------------------------------
1 | #ifndef CURLINC_CURLVER_H
2 | #define CURLINC_CURLVER_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | * SPDX-License-Identifier: curl
24 | *
25 | ***************************************************************************/
26 |
27 | /* This header file contains nothing but libcurl version info, generated by
28 | a script at release-time. This was made its own header file in 7.11.2 */
29 |
30 | /* This is the global package copyright */
31 | #define LIBCURL_COPYRIGHT "Daniel Stenberg, ."
32 |
33 | /* This is the version number of the libcurl package from which this header
34 | file origins: */
35 | #define LIBCURL_VERSION "8.10.1-DEV"
36 |
37 | /* The numeric version number is also available "in parts" by using these
38 | defines: */
39 | #define LIBCURL_VERSION_MAJOR 8
40 | #define LIBCURL_VERSION_MINOR 10
41 | #define LIBCURL_VERSION_PATCH 1
42 |
43 | /* This is the numeric version of the libcurl version number, meant for easier
44 | parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
45 | always follow this syntax:
46 |
47 | 0xXXYYZZ
48 |
49 | Where XX, YY and ZZ are the main version, release and patch numbers in
50 | hexadecimal (using 8 bits each). All three numbers are always represented
51 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7
52 | appears as "0x090b07".
53 |
54 | This 6-digit (24 bits) hexadecimal number does not show pre-release number,
55 | and it is always a greater number in a more recent release. It makes
56 | comparisons with greater than and less than work.
57 |
58 | Note: This define is the full hex number and _does not_ use the
59 | CURL_VERSION_BITS() macro since curl's own configure script greps for it
60 | and needs it to contain the full number.
61 | */
62 | #define LIBCURL_VERSION_NUM 0x080a01
63 |
64 | /*
65 | * This is the date and time when the full source package was created. The
66 | * timestamp is not stored in git, as the timestamp is properly set in the
67 | * tarballs by the maketgz script.
68 | *
69 | * The format of the date follows this template:
70 | *
71 | * "2007-11-23"
72 | */
73 | #define LIBCURL_TIMESTAMP "[unreleased]"
74 |
75 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
76 | #define CURL_AT_LEAST_VERSION(x,y,z) \
77 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
78 |
79 | #endif /* CURLINC_CURLVER_H */
80 |
--------------------------------------------------------------------------------
/curl/easy.h:
--------------------------------------------------------------------------------
1 | #ifndef CURLINC_EASY_H
2 | #define CURLINC_EASY_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | * SPDX-License-Identifier: curl
24 | *
25 | ***************************************************************************/
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Flag bits in the curl_blob struct: */
31 | #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */
32 | #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */
33 |
34 | struct curl_blob {
35 | void *data;
36 | size_t len;
37 | unsigned int flags; /* bit 0 is defined, the rest are reserved and should be
38 | left zeroes */
39 | };
40 |
41 | CURL_EXTERN CURL *curl_easy_init(void);
42 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
43 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
44 | CURL_EXTERN void curl_easy_cleanup(CURL *curl);
45 |
46 | /*
47 | * NAME curl_easy_getinfo()
48 | *
49 | * DESCRIPTION
50 | *
51 | * Request internal information from the curl session with this function.
52 | * The third argument MUST be pointing to the specific type of the used option
53 | * which is documented in each manpage of the option. The data pointed to
54 | * will be filled in accordingly and can be relied upon only if the function
55 | * returns CURLE_OK. This function is intended to get used *AFTER* a performed
56 | * transfer, all results from this function are undefined until the transfer
57 | * is completed.
58 | */
59 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
60 |
61 |
62 | /*
63 | * NAME curl_easy_duphandle()
64 | *
65 | * DESCRIPTION
66 | *
67 | * Creates a new curl session handle with the same options set for the handle
68 | * passed in. Duplicating a handle could only be a matter of cloning data and
69 | * options, internal state info and things like persistent connections cannot
70 | * be transferred. It is useful in multithreaded applications when you can run
71 | * curl_easy_duphandle() for each new thread to avoid a series of identical
72 | * curl_easy_setopt() invokes in every thread.
73 | */
74 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
75 |
76 | /*
77 | * NAME curl_easy_reset()
78 | *
79 | * DESCRIPTION
80 | *
81 | * Re-initializes a CURL handle to the default values. This puts back the
82 | * handle to the same state as it was in when it was just created.
83 | *
84 | * It does keep: live connections, the Session ID cache, the DNS cache and the
85 | * cookies.
86 | */
87 | CURL_EXTERN void curl_easy_reset(CURL *curl);
88 |
89 | /*
90 | * NAME curl_easy_recv()
91 | *
92 | * DESCRIPTION
93 | *
94 | * Receives data from the connected socket. Use after successful
95 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
96 | */
97 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
98 | size_t *n);
99 |
100 | /*
101 | * NAME curl_easy_send()
102 | *
103 | * DESCRIPTION
104 | *
105 | * Sends data over the connected socket. Use after successful
106 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
107 | */
108 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
109 | size_t buflen, size_t *n);
110 |
111 |
112 | /*
113 | * NAME curl_easy_upkeep()
114 | *
115 | * DESCRIPTION
116 | *
117 | * Performs connection upkeep for the given session handle.
118 | */
119 | CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl);
120 |
121 | #ifdef __cplusplus
122 | } /* end of extern "C" */
123 | #endif
124 |
125 | #endif
126 |
--------------------------------------------------------------------------------
/curl/header.h:
--------------------------------------------------------------------------------
1 | #ifndef CURLINC_HEADER_H
2 | #define CURLINC_HEADER_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | * SPDX-License-Identifier: curl
24 | *
25 | ***************************************************************************/
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | struct curl_header {
32 | char *name; /* this might not use the same case */
33 | char *value;
34 | size_t amount; /* number of headers using this name */
35 | size_t index; /* ... of this instance, 0 or higher */
36 | unsigned int origin; /* see bits below */
37 | void *anchor; /* handle privately used by libcurl */
38 | };
39 |
40 | /* 'origin' bits */
41 | #define CURLH_HEADER (1<<0) /* plain server header */
42 | #define CURLH_TRAILER (1<<1) /* trailers */
43 | #define CURLH_CONNECT (1<<2) /* CONNECT headers */
44 | #define CURLH_1XX (1<<3) /* 1xx headers */
45 | #define CURLH_PSEUDO (1<<4) /* pseudo headers */
46 |
47 | typedef enum {
48 | CURLHE_OK,
49 | CURLHE_BADINDEX, /* header exists but not with this index */
50 | CURLHE_MISSING, /* no such header exists */
51 | CURLHE_NOHEADERS, /* no headers at all exist (yet) */
52 | CURLHE_NOREQUEST, /* no request with this number was used */
53 | CURLHE_OUT_OF_MEMORY, /* out of memory while processing */
54 | CURLHE_BAD_ARGUMENT, /* a function argument was not okay */
55 | CURLHE_NOT_BUILT_IN /* if API was disabled in the build */
56 | } CURLHcode;
57 |
58 | CURL_EXTERN CURLHcode curl_easy_header(CURL *easy,
59 | const char *name,
60 | size_t index,
61 | unsigned int origin,
62 | int request,
63 | struct curl_header **hout);
64 |
65 | CURL_EXTERN struct curl_header *curl_easy_nextheader(CURL *easy,
66 | unsigned int origin,
67 | int request,
68 | struct curl_header *prev);
69 |
70 | #ifdef __cplusplus
71 | } /* end of extern "C" */
72 | #endif
73 |
74 | #endif /* CURLINC_HEADER_H */
75 |
--------------------------------------------------------------------------------
/curl/libcurl.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KeyAuth/keyauth-cpp-library-1.3API/3ef070362dbf305bff28032f1261e3e2109b8110/curl/libcurl.lib
--------------------------------------------------------------------------------
/curl/mprintf.h:
--------------------------------------------------------------------------------
1 | #ifndef CURLINC_MPRINTF_H
2 | #define CURLINC_MPRINTF_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | * SPDX-License-Identifier: curl
24 | *
25 | ***************************************************************************/
26 |
27 | #include
28 | #include /* needed for FILE */
29 | #include "curl.h" /* for CURL_EXTERN */
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | #ifndef CURL_TEMP_PRINTF
36 | #if (defined(__GNUC__) || defined(__clang__) || \
37 | defined(__IAR_SYSTEMS_ICC__)) && \
38 | defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
39 | !defined(CURL_NO_FMT_CHECKS)
40 | #if defined(__MINGW32__) && !defined(__clang__)
41 | #if defined(__MINGW_PRINTF_FORMAT) /* mingw-w64 3.0.0+. Needs stdio.h. */
42 | #define CURL_TEMP_PRINTF(fmt, arg) \
43 | __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, arg)))
44 | #else
45 | #define CURL_TEMP_PRINTF(fmt, arg)
46 | #endif
47 | #else
48 | #define CURL_TEMP_PRINTF(fmt, arg) \
49 | __attribute__((format(printf, fmt, arg)))
50 | #endif
51 | #else
52 | #define CURL_TEMP_PRINTF(fmt, arg)
53 | #endif
54 | #endif
55 |
56 | CURL_EXTERN int curl_mprintf(const char *format, ...)
57 | CURL_TEMP_PRINTF(1, 2);
58 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...)
59 | CURL_TEMP_PRINTF(2, 3);
60 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...)
61 | CURL_TEMP_PRINTF(2, 3);
62 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
63 | const char *format, ...)
64 | CURL_TEMP_PRINTF(3, 4);
65 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args)
66 | CURL_TEMP_PRINTF(1, 0);
67 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args)
68 | CURL_TEMP_PRINTF(2, 0);
69 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args)
70 | CURL_TEMP_PRINTF(2, 0);
71 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
72 | const char *format, va_list args)
73 | CURL_TEMP_PRINTF(3, 0);
74 | CURL_EXTERN char *curl_maprintf(const char *format, ...)
75 | CURL_TEMP_PRINTF(1, 2);
76 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args)
77 | CURL_TEMP_PRINTF(1, 0);
78 |
79 | #undef CURL_TEMP_PRINTF
80 |
81 | #ifdef __cplusplus
82 | } /* end of extern "C" */
83 | #endif
84 |
85 | #endif /* CURLINC_MPRINTF_H */
86 |
--------------------------------------------------------------------------------
/curl/options.h:
--------------------------------------------------------------------------------
1 | #ifndef CURLINC_OPTIONS_H
2 | #define CURLINC_OPTIONS_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | * SPDX-License-Identifier: curl
24 | *
25 | ***************************************************************************/
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | typedef enum {
32 | CURLOT_LONG, /* long (a range of values) */
33 | CURLOT_VALUES, /* (a defined set or bitmask) */
34 | CURLOT_OFF_T, /* curl_off_t (a range of values) */
35 | CURLOT_OBJECT, /* pointer (void *) */
36 | CURLOT_STRING, /* (char * to null-terminated buffer) */
37 | CURLOT_SLIST, /* (struct curl_slist *) */
38 | CURLOT_CBPTR, /* (void * passed as-is to a callback) */
39 | CURLOT_BLOB, /* blob (struct curl_blob *) */
40 | CURLOT_FUNCTION /* function pointer */
41 | } curl_easytype;
42 |
43 | /* Flag bits */
44 |
45 | /* "alias" means it is provided for old programs to remain functional,
46 | we prefer another name */
47 | #define CURLOT_FLAG_ALIAS (1<<0)
48 |
49 | /* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
50 | to use for curl_easy_setopt() for the given id */
51 | struct curl_easyoption {
52 | const char *name;
53 | CURLoption id;
54 | curl_easytype type;
55 | unsigned int flags;
56 | };
57 |
58 | CURL_EXTERN const struct curl_easyoption *
59 | curl_easy_option_by_name(const char *name);
60 |
61 | CURL_EXTERN const struct curl_easyoption *
62 | curl_easy_option_by_id(CURLoption id);
63 |
64 | CURL_EXTERN const struct curl_easyoption *
65 | curl_easy_option_next(const struct curl_easyoption *prev);
66 |
67 | #ifdef __cplusplus
68 | } /* end of extern "C" */
69 | #endif
70 | #endif /* CURLINC_OPTIONS_H */
71 |
--------------------------------------------------------------------------------
/curl/stdcheaders.h:
--------------------------------------------------------------------------------
1 | #ifndef CURLINC_STDCHEADERS_H
2 | #define CURLINC_STDCHEADERS_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | * SPDX-License-Identifier: curl
24 | *
25 | ***************************************************************************/
26 |
27 | #include
28 |
29 | size_t fread(void *, size_t, size_t, FILE *);
30 | size_t fwrite(const void *, size_t, size_t, FILE *);
31 |
32 | int strcasecmp(const char *, const char *);
33 | int strncasecmp(const char *, const char *, size_t);
34 |
35 | #endif /* CURLINC_STDCHEADERS_H */
36 |
--------------------------------------------------------------------------------
/curl/websockets.h:
--------------------------------------------------------------------------------
1 | #ifndef CURLINC_WEBSOCKETS_H
2 | #define CURLINC_WEBSOCKETS_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | * SPDX-License-Identifier: curl
24 | *
25 | ***************************************************************************/
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | struct curl_ws_frame {
32 | int age; /* zero */
33 | int flags; /* See the CURLWS_* defines */
34 | curl_off_t offset; /* the offset of this data into the frame */
35 | curl_off_t bytesleft; /* number of pending bytes left of the payload */
36 | size_t len; /* size of the current data chunk */
37 | };
38 |
39 | /* flag bits */
40 | #define CURLWS_TEXT (1<<0)
41 | #define CURLWS_BINARY (1<<1)
42 | #define CURLWS_CONT (1<<2)
43 | #define CURLWS_CLOSE (1<<3)
44 | #define CURLWS_PING (1<<4)
45 | #define CURLWS_OFFSET (1<<5)
46 |
47 | /*
48 | * NAME curl_ws_recv()
49 | *
50 | * DESCRIPTION
51 | *
52 | * Receives data from the websocket connection. Use after successful
53 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
54 | */
55 | CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
56 | size_t *recv,
57 | const struct curl_ws_frame **metap);
58 |
59 | /* flags for curl_ws_send() */
60 | #define CURLWS_PONG (1<<6)
61 |
62 | /*
63 | * NAME curl_ws_send()
64 | *
65 | * DESCRIPTION
66 | *
67 | * Sends data over the websocket connection. Use after successful
68 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
69 | */
70 | CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer,
71 | size_t buflen, size_t *sent,
72 | curl_off_t fragsize,
73 | unsigned int flags);
74 |
75 | /* bits for the CURLOPT_WS_OPTIONS bitmask: */
76 | #define CURLWS_RAW_MODE (1<<0)
77 |
78 | CURL_EXTERN const struct curl_ws_frame *curl_ws_meta(CURL *curl);
79 |
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 |
84 | #endif /* CURLINC_WEBSOCKETS_H */
85 |
--------------------------------------------------------------------------------
/curl/zlib.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KeyAuth/keyauth-cpp-library-1.3API/3ef070362dbf305bff28032f1261e3e2109b8110/curl/zlib.lib
--------------------------------------------------------------------------------
/includes.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #pragma comment (lib, "advapi32.lib")
8 | #pragma comment(lib, "Normaliz.lib")
9 | #pragma comment(lib, "wldap32.lib" )
10 | #pragma comment(lib, "crypt32.lib" )
11 | #pragma comment(lib, "Ws2_32.lib")
12 |
13 | #define CURL_STATICLIB
14 | #include
15 |
16 | #include
17 |
18 | #include "utils.hpp"
--------------------------------------------------------------------------------
/killEmulator.hpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | // https://github.com/LiamG53
6 |
7 | namespace protection
8 | {
9 | enum types
10 | {
11 | search = EXCEPTION_CONTINUE_SEARCH,
12 | page_guard_violation = STATUS_GUARD_PAGE_VIOLATION,
13 | break_point = STATUS_BREAKPOINT,
14 | long_jump = STATUS_LONGJUMP
15 | };
16 |
17 | // helper function to determine wether or not the address is within the current module/handle.
18 | bool within_region(HMODULE module, LPVOID address)
19 | {
20 | MODULEINFO info; // place holder for the information
21 |
22 | // use this function in order to get the module information.
23 | bool result = GetModuleInformation(reinterpret_cast(-1),
24 | module, &info, sizeof(info));
25 | if (result)
26 | {
27 | LPVOID module_base = info.lpBaseOfDll;
28 | size_t module_size = info.SizeOfImage;
29 |
30 | // return wether not the module is within the means of the current image size and base.
31 | return (address >= module_base &&
32 | address < (PBYTE)module_base + module_size);
33 | }
34 | return false; // failed to get the information.
35 | }
36 |
37 | long handler(EXCEPTION_POINTERS *info)
38 | {
39 | // place holder for the current module, in regards with our regional memory checks.
40 | static auto current_module =
41 | GetModuleHandleA(0);
42 | if (!current_module)
43 | {
44 | // throw a random page guard violation causing the application to most likely crash
45 | return types::page_guard_violation;
46 | }
47 |
48 | // get the return address for this context.
49 | #ifdef _WIN64
50 | auto return_address = info->ContextRecord->Rip;
51 | if (return_address != info->ContextRecord->Rip)
52 | {
53 | // tampered with the return address via an external process or via byte patching.
54 | // either way we will detect it.
55 | return types::page_guard_violation;
56 | }
57 |
58 | // check if the return address is within the region of our process memory.
59 | if (!within_region(current_module,
60 | reinterpret_cast(return_address)))
61 | {
62 | return types::page_guard_violation;
63 | }
64 | #else
65 | auto return_address = info->ContextRecord->Eip;
66 | if (return_address != info->ContextRecord->Eip)
67 | {
68 | // tampered with the return address via an external process or via byte patching.
69 | // either way we will detect it.
70 | return types::page_guard_violation;
71 | }
72 |
73 | // check if the return address is within the region of our process memory.
74 | if (!within_region(current_module,
75 | reinterpret_cast(return_address)))
76 | {
77 | return types::page_guard_violation;
78 | }
79 | #endif
80 |
81 | // check for long jumps if they are within the modules memory
82 | if (info->ExceptionRecord->ExceptionCode == types::long_jump)
83 | {
84 | if (!within_region(current_module,
85 | reinterpret_cast(info->ExceptionRecord->ExceptionAddress)))
86 | {
87 | return types::page_guard_violation;
88 | }
89 | }
90 |
91 | // check breakpoints because some people like writing bytes which are weird
92 | if (info->ExceptionRecord->ExceptionCode == types::break_point)
93 | {
94 | if (!within_region(current_module,
95 | reinterpret_cast(info->ExceptionRecord->ExceptionAddress)))
96 | {
97 | return types::page_guard_violation;
98 | }
99 | }
100 |
101 | // continue on with the search
102 | return types::search;
103 | }
104 |
105 | void init()
106 | {
107 | AddVectoredExceptionHandler(true, (PVECTORED_EXCEPTION_HANDLER)handler);
108 | }
109 | };
110 |
--------------------------------------------------------------------------------
/library.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.6.33815.320
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "library", "library.vcxproj", "{03A87D79-B6BB-4199-BD0C-97158912F6AB}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Release|x64 = Release|x64
11 | Release|x86 = Release|x86
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {03A87D79-B6BB-4199-BD0C-97158912F6AB}.Release|x64.ActiveCfg = Release|x64
15 | {03A87D79-B6BB-4199-BD0C-97158912F6AB}.Release|x64.Build.0 = Release|x64
16 | {03A87D79-B6BB-4199-BD0C-97158912F6AB}.Release|x86.ActiveCfg = Release|Win32
17 | {03A87D79-B6BB-4199-BD0C-97158912F6AB}.Release|x86.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {92264801-AC2A-4D75-BF79-A3B7BB9B3F9A}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/library.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
--------------------------------------------------------------------------------
/libsodium/libsodium.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KeyAuth/keyauth-cpp-library-1.3API/3ef070362dbf305bff28032f1261e3e2109b8110/libsodium/libsodium.lib
--------------------------------------------------------------------------------
/libsodium/sodium.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_H
3 | #define sodium_H
4 |
5 | #include "sodium/version.h"
6 |
7 | #include "sodium/core.h"
8 | #include "sodium/crypto_aead_aegis128l.h"
9 | #include "sodium/crypto_aead_aegis256.h"
10 | #include "sodium/crypto_aead_aes256gcm.h"
11 | #include "sodium/crypto_aead_chacha20poly1305.h"
12 | #include "sodium/crypto_aead_xchacha20poly1305.h"
13 | #include "sodium/crypto_auth.h"
14 | #include "sodium/crypto_auth_hmacsha256.h"
15 | #include "sodium/crypto_auth_hmacsha512.h"
16 | #include "sodium/crypto_auth_hmacsha512256.h"
17 | #include "sodium/crypto_box.h"
18 | #include "sodium/crypto_box_curve25519xsalsa20poly1305.h"
19 | #include "sodium/crypto_core_hchacha20.h"
20 | #include "sodium/crypto_core_hsalsa20.h"
21 | #include "sodium/crypto_core_salsa20.h"
22 | #include "sodium/crypto_core_salsa2012.h"
23 | #include "sodium/crypto_core_salsa208.h"
24 | #include "sodium/crypto_generichash.h"
25 | #include "sodium/crypto_generichash_blake2b.h"
26 | #include "sodium/crypto_hash.h"
27 | #include "sodium/crypto_hash_sha256.h"
28 | #include "sodium/crypto_hash_sha512.h"
29 | #include "sodium/crypto_kdf.h"
30 | #include "sodium/crypto_kdf_hkdf_sha256.h"
31 | #include "sodium/crypto_kdf_hkdf_sha512.h"
32 | #include "sodium/crypto_kdf_blake2b.h"
33 | #include "sodium/crypto_kdf_hkdf_sha256.h"
34 | #include "sodium/crypto_kdf_hkdf_sha512.h"
35 | #include "sodium/crypto_kx.h"
36 | #include "sodium/crypto_onetimeauth.h"
37 | #include "sodium/crypto_onetimeauth_poly1305.h"
38 | #include "sodium/crypto_pwhash.h"
39 | #include "sodium/crypto_pwhash_argon2i.h"
40 | #include "sodium/crypto_scalarmult.h"
41 | #include "sodium/crypto_scalarmult_curve25519.h"
42 | #include "sodium/crypto_secretbox.h"
43 | #include "sodium/crypto_secretbox_xsalsa20poly1305.h"
44 | #include "sodium/crypto_secretstream_xchacha20poly1305.h"
45 | #include "sodium/crypto_shorthash.h"
46 | #include "sodium/crypto_shorthash_siphash24.h"
47 | #include "sodium/crypto_sign.h"
48 | #include "sodium/crypto_sign_ed25519.h"
49 | #include "sodium/crypto_stream.h"
50 | #include "sodium/crypto_stream_chacha20.h"
51 | #include "sodium/crypto_stream_salsa20.h"
52 | #include "sodium/crypto_stream_xsalsa20.h"
53 | #include "sodium/crypto_verify_16.h"
54 | #include "sodium/crypto_verify_32.h"
55 | #include "sodium/crypto_verify_64.h"
56 | #include "sodium/randombytes.h"
57 | #include "sodium/randombytes_internal_random.h"
58 | #include "sodium/randombytes_sysrandom.h"
59 | #include "sodium/runtime.h"
60 | #include "sodium/utils.h"
61 |
62 | #ifndef SODIUM_LIBRARY_MINIMAL
63 | #include "sodium/crypto_box_curve25519xchacha20poly1305.h"
64 | #include "sodium/crypto_core_ed25519.h"
65 | #include "sodium/crypto_core_ristretto255.h"
66 | #include "sodium/crypto_pwhash_scryptsalsa208sha256.h"
67 | #include "sodium/crypto_scalarmult_ed25519.h"
68 | #include "sodium/crypto_scalarmult_ristretto255.h"
69 | #include "sodium/crypto_secretbox_xchacha20poly1305.h"
70 | #include "sodium/crypto_stream_salsa2012.h"
71 | #include "sodium/crypto_stream_salsa208.h"
72 | #include "sodium/crypto_stream_xchacha20.h"
73 | #endif
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/libsodium/sodium/core.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_core_H
3 | #define sodium_core_H
4 |
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | SODIUM_EXPORT
12 | int sodium_init(void)
13 | __attribute__ ((warn_unused_result));
14 |
15 | /* ---- */
16 |
17 | SODIUM_EXPORT
18 | int sodium_set_misuse_handler(void (*handler)(void));
19 |
20 | SODIUM_EXPORT
21 | void sodium_misuse(void)
22 | __attribute__ ((noreturn));
23 |
24 | #ifdef __cplusplus
25 | }
26 | #endif
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_aead_aegis128l.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_aead_aegis128l_H
2 | #define crypto_aead_aegis128l_H
3 |
4 | #include
5 |
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | #ifdef __GNUC__
10 | #pragma GCC diagnostic ignored "-Wlong-long"
11 | #endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_aead_aegis128l_KEYBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_aead_aegis128l_keybytes(void);
18 |
19 | #define crypto_aead_aegis128l_NSECBYTES 0U
20 | SODIUM_EXPORT
21 | size_t crypto_aead_aegis128l_nsecbytes(void);
22 |
23 | #define crypto_aead_aegis128l_NPUBBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_aead_aegis128l_npubbytes(void);
26 |
27 | #define crypto_aead_aegis128l_ABYTES 32U
28 | SODIUM_EXPORT
29 | size_t crypto_aead_aegis128l_abytes(void);
30 |
31 | #define crypto_aead_aegis128l_MESSAGEBYTES_MAX \
32 | SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis128l_ABYTES, (1ULL << 61) - 1)
33 | SODIUM_EXPORT
34 | size_t crypto_aead_aegis128l_messagebytes_max(void);
35 |
36 | SODIUM_EXPORT
37 | int crypto_aead_aegis128l_encrypt(unsigned char *c,
38 | unsigned long long *clen_p,
39 | const unsigned char *m,
40 | unsigned long long mlen,
41 | const unsigned char *ad,
42 | unsigned long long adlen,
43 | const unsigned char *nsec,
44 | const unsigned char *npub,
45 | const unsigned char *k) __attribute__((nonnull(1, 8, 9)));
46 |
47 | SODIUM_EXPORT
48 | int crypto_aead_aegis128l_decrypt(unsigned char *m,
49 | unsigned long long *mlen_p,
50 | unsigned char *nsec,
51 | const unsigned char *c,
52 | unsigned long long clen,
53 | const unsigned char *ad,
54 | unsigned long long adlen,
55 | const unsigned char *npub,
56 | const unsigned char *k) __attribute__((warn_unused_result))
57 | __attribute__((nonnull(4, 8, 9)));
58 |
59 | SODIUM_EXPORT
60 | int crypto_aead_aegis128l_encrypt_detached(unsigned char *c,
61 | unsigned char *mac,
62 | unsigned long long *maclen_p,
63 | const unsigned char *m,
64 | unsigned long long mlen,
65 | const unsigned char *ad,
66 | unsigned long long adlen,
67 | const unsigned char *nsec,
68 | const unsigned char *npub,
69 | const unsigned char *k)
70 | __attribute__((nonnull(1, 2, 9, 10)));
71 |
72 | SODIUM_EXPORT
73 | int crypto_aead_aegis128l_decrypt_detached(unsigned char *m,
74 | unsigned char *nsec,
75 | const unsigned char *c,
76 | unsigned long long clen,
77 | const unsigned char *mac,
78 | const unsigned char *ad,
79 | unsigned long long adlen,
80 | const unsigned char *npub,
81 | const unsigned char *k)
82 | __attribute__((warn_unused_result)) __attribute__((nonnull(3, 5, 8, 9)));
83 |
84 | SODIUM_EXPORT
85 | void crypto_aead_aegis128l_keygen(unsigned char k[crypto_aead_aegis128l_KEYBYTES])
86 | __attribute__((nonnull));
87 |
88 | #ifdef __cplusplus
89 | }
90 | #endif
91 |
92 | #endif
93 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_aead_aegis256.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_aead_aegis256_H
2 | #define crypto_aead_aegis256_H
3 |
4 | #include
5 |
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | #ifdef __GNUC__
10 | #pragma GCC diagnostic ignored "-Wlong-long"
11 | #endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_aead_aegis256_KEYBYTES 32U
16 | SODIUM_EXPORT
17 | size_t crypto_aead_aegis256_keybytes(void);
18 |
19 | #define crypto_aead_aegis256_NSECBYTES 0U
20 | SODIUM_EXPORT
21 | size_t crypto_aead_aegis256_nsecbytes(void);
22 |
23 | #define crypto_aead_aegis256_NPUBBYTES 32U
24 | SODIUM_EXPORT
25 | size_t crypto_aead_aegis256_npubbytes(void);
26 |
27 | #define crypto_aead_aegis256_ABYTES 32U
28 | SODIUM_EXPORT
29 | size_t crypto_aead_aegis256_abytes(void);
30 |
31 | #define crypto_aead_aegis256_MESSAGEBYTES_MAX \
32 | SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis256_ABYTES, (1ULL << 61) - 1)
33 | SODIUM_EXPORT
34 | size_t crypto_aead_aegis256_messagebytes_max(void);
35 |
36 | SODIUM_EXPORT
37 | int crypto_aead_aegis256_encrypt(unsigned char *c,
38 | unsigned long long *clen_p,
39 | const unsigned char *m,
40 | unsigned long long mlen,
41 | const unsigned char *ad,
42 | unsigned long long adlen,
43 | const unsigned char *nsec,
44 | const unsigned char *npub,
45 | const unsigned char *k) __attribute__((nonnull(1, 8, 9)));
46 |
47 | SODIUM_EXPORT
48 | int crypto_aead_aegis256_decrypt(unsigned char *m,
49 | unsigned long long *mlen_p,
50 | unsigned char *nsec,
51 | const unsigned char *c,
52 | unsigned long long clen,
53 | const unsigned char *ad,
54 | unsigned long long adlen,
55 | const unsigned char *npub,
56 | const unsigned char *k) __attribute__((warn_unused_result))
57 | __attribute__((nonnull(4, 8, 9)));
58 |
59 | SODIUM_EXPORT
60 | int crypto_aead_aegis256_encrypt_detached(unsigned char *c,
61 | unsigned char *mac,
62 | unsigned long long *maclen_p,
63 | const unsigned char *m,
64 | unsigned long long mlen,
65 | const unsigned char *ad,
66 | unsigned long long adlen,
67 | const unsigned char *nsec,
68 | const unsigned char *npub,
69 | const unsigned char *k)
70 | __attribute__((nonnull(1, 2, 9, 10)));
71 |
72 | SODIUM_EXPORT
73 | int crypto_aead_aegis256_decrypt_detached(unsigned char *m,
74 | unsigned char *nsec,
75 | const unsigned char *c,
76 | unsigned long long clen,
77 | const unsigned char *mac,
78 | const unsigned char *ad,
79 | unsigned long long adlen,
80 | const unsigned char *npub,
81 | const unsigned char *k)
82 | __attribute__((warn_unused_result)) __attribute__((nonnull(3, 5, 8, 9)));
83 |
84 | SODIUM_EXPORT
85 | void crypto_aead_aegis256_keygen(unsigned char k[crypto_aead_aegis256_KEYBYTES])
86 | __attribute__((nonnull));
87 |
88 | #ifdef __cplusplus
89 | }
90 | #endif
91 |
92 | #endif
93 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_auth.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_auth_H
2 | #define crypto_auth_H
3 |
4 | #include
5 |
6 | #include "crypto_auth_hmacsha512256.h"
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | # ifdef __GNUC__
11 | # pragma GCC diagnostic ignored "-Wlong-long"
12 | # endif
13 | extern "C" {
14 | #endif
15 |
16 | #define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
17 | SODIUM_EXPORT
18 | size_t crypto_auth_bytes(void);
19 |
20 | #define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
21 | SODIUM_EXPORT
22 | size_t crypto_auth_keybytes(void);
23 |
24 | #define crypto_auth_PRIMITIVE "hmacsha512256"
25 | SODIUM_EXPORT
26 | const char *crypto_auth_primitive(void);
27 |
28 | SODIUM_EXPORT
29 | int crypto_auth(unsigned char *out, const unsigned char *in,
30 | unsigned long long inlen, const unsigned char *k)
31 | __attribute__ ((nonnull(1, 4)));
32 |
33 | SODIUM_EXPORT
34 | int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
35 | unsigned long long inlen, const unsigned char *k)
36 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
37 |
38 | SODIUM_EXPORT
39 | void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
40 | __attribute__ ((nonnull));
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_auth_hmacsha256.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_auth_hmacsha256_H
2 | #define crypto_auth_hmacsha256_H
3 |
4 | #include
5 | #include "crypto_hash_sha256.h"
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_auth_hmacsha256_BYTES 32U
16 | SODIUM_EXPORT
17 | size_t crypto_auth_hmacsha256_bytes(void);
18 |
19 | #define crypto_auth_hmacsha256_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_auth_hmacsha256_keybytes(void);
22 |
23 | SODIUM_EXPORT
24 | int crypto_auth_hmacsha256(unsigned char *out,
25 | const unsigned char *in,
26 | unsigned long long inlen,
27 | const unsigned char *k) __attribute__ ((nonnull(1, 4)));
28 |
29 | SODIUM_EXPORT
30 | int crypto_auth_hmacsha256_verify(const unsigned char *h,
31 | const unsigned char *in,
32 | unsigned long long inlen,
33 | const unsigned char *k)
34 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
35 |
36 | /* ------------------------------------------------------------------------- */
37 |
38 | typedef struct crypto_auth_hmacsha256_state {
39 | crypto_hash_sha256_state ictx;
40 | crypto_hash_sha256_state octx;
41 | } crypto_auth_hmacsha256_state;
42 |
43 | SODIUM_EXPORT
44 | size_t crypto_auth_hmacsha256_statebytes(void);
45 |
46 | SODIUM_EXPORT
47 | int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
48 | const unsigned char *key,
49 | size_t keylen) __attribute__ ((nonnull));
50 |
51 | SODIUM_EXPORT
52 | int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
53 | const unsigned char *in,
54 | unsigned long long inlen)
55 | __attribute__ ((nonnull(1)));
56 |
57 | SODIUM_EXPORT
58 | int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
59 | unsigned char *out) __attribute__ ((nonnull));
60 |
61 |
62 | SODIUM_EXPORT
63 | void crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES])
64 | __attribute__ ((nonnull));
65 |
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_auth_hmacsha512.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_auth_hmacsha512_H
2 | #define crypto_auth_hmacsha512_H
3 |
4 | #include
5 | #include "crypto_hash_sha512.h"
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_auth_hmacsha512_BYTES 64U
16 | SODIUM_EXPORT
17 | size_t crypto_auth_hmacsha512_bytes(void);
18 |
19 | #define crypto_auth_hmacsha512_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_auth_hmacsha512_keybytes(void);
22 |
23 | SODIUM_EXPORT
24 | int crypto_auth_hmacsha512(unsigned char *out,
25 | const unsigned char *in,
26 | unsigned long long inlen,
27 | const unsigned char *k) __attribute__ ((nonnull(1, 4)));
28 |
29 | SODIUM_EXPORT
30 | int crypto_auth_hmacsha512_verify(const unsigned char *h,
31 | const unsigned char *in,
32 | unsigned long long inlen,
33 | const unsigned char *k)
34 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
35 |
36 | /* ------------------------------------------------------------------------- */
37 |
38 | typedef struct crypto_auth_hmacsha512_state {
39 | crypto_hash_sha512_state ictx;
40 | crypto_hash_sha512_state octx;
41 | } crypto_auth_hmacsha512_state;
42 |
43 | SODIUM_EXPORT
44 | size_t crypto_auth_hmacsha512_statebytes(void);
45 |
46 | SODIUM_EXPORT
47 | int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
48 | const unsigned char *key,
49 | size_t keylen) __attribute__ ((nonnull));
50 |
51 | SODIUM_EXPORT
52 | int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
53 | const unsigned char *in,
54 | unsigned long long inlen) __attribute__ ((nonnull(1)));
55 |
56 | SODIUM_EXPORT
57 | int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
58 | unsigned char *out) __attribute__ ((nonnull));
59 |
60 | SODIUM_EXPORT
61 | void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES])
62 | __attribute__ ((nonnull));
63 |
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 |
68 | #endif
69 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_auth_hmacsha512256.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_auth_hmacsha512256_H
2 | #define crypto_auth_hmacsha512256_H
3 |
4 | #include
5 | #include "crypto_auth_hmacsha512.h"
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_auth_hmacsha512256_BYTES 32U
16 | SODIUM_EXPORT
17 | size_t crypto_auth_hmacsha512256_bytes(void);
18 |
19 | #define crypto_auth_hmacsha512256_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_auth_hmacsha512256_keybytes(void);
22 |
23 | SODIUM_EXPORT
24 | int crypto_auth_hmacsha512256(unsigned char *out,
25 | const unsigned char *in,
26 | unsigned long long inlen,
27 | const unsigned char *k) __attribute__ ((nonnull(1, 4)));
28 |
29 | SODIUM_EXPORT
30 | int crypto_auth_hmacsha512256_verify(const unsigned char *h,
31 | const unsigned char *in,
32 | unsigned long long inlen,
33 | const unsigned char *k)
34 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
35 |
36 | /* ------------------------------------------------------------------------- */
37 |
38 | typedef crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state;
39 |
40 | SODIUM_EXPORT
41 | size_t crypto_auth_hmacsha512256_statebytes(void);
42 |
43 | SODIUM_EXPORT
44 | int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
45 | const unsigned char *key,
46 | size_t keylen) __attribute__ ((nonnull));
47 |
48 | SODIUM_EXPORT
49 | int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
50 | const unsigned char *in,
51 | unsigned long long inlen) __attribute__ ((nonnull(1)));
52 |
53 | SODIUM_EXPORT
54 | int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
55 | unsigned char *out) __attribute__ ((nonnull));
56 |
57 | SODIUM_EXPORT
58 | void crypto_auth_hmacsha512256_keygen(unsigned char k[crypto_auth_hmacsha512256_KEYBYTES])
59 | __attribute__ ((nonnull));
60 |
61 | #ifdef __cplusplus
62 | }
63 | #endif
64 |
65 | #endif
66 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_box_curve25519xsalsa20poly1305.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_box_curve25519xsalsa20poly1305_H
2 | #define crypto_box_curve25519xsalsa20poly1305_H
3 |
4 | #include
5 | #include "crypto_stream_xsalsa20.h"
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U
16 | SODIUM_EXPORT
17 | size_t crypto_box_curve25519xsalsa20poly1305_seedbytes(void);
18 |
19 | #define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void);
22 |
23 | #define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES 32U
24 | SODIUM_EXPORT
25 | size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void);
26 |
27 | #define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES 32U
28 | SODIUM_EXPORT
29 | size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void);
30 |
31 | #define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES 24U
32 | SODIUM_EXPORT
33 | size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void);
34 |
35 | #define crypto_box_curve25519xsalsa20poly1305_MACBYTES 16U
36 | SODIUM_EXPORT
37 | size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
38 |
39 | /* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
40 | #define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \
41 | (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES)
42 | SODIUM_EXPORT
43 | size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void);
44 |
45 | SODIUM_EXPORT
46 | int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
47 | unsigned char *sk,
48 | const unsigned char *seed)
49 | __attribute__ ((nonnull));
50 |
51 | SODIUM_EXPORT
52 | int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
53 | unsigned char *sk)
54 | __attribute__ ((nonnull));
55 |
56 | SODIUM_EXPORT
57 | int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
58 | const unsigned char *pk,
59 | const unsigned char *sk)
60 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
61 |
62 | /* -- NaCl compatibility interface ; Requires padding -- */
63 |
64 | #define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U
65 | SODIUM_EXPORT
66 | size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
67 |
68 | #define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES \
69 | (crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES + \
70 | crypto_box_curve25519xsalsa20poly1305_MACBYTES)
71 | SODIUM_EXPORT
72 | size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void);
73 |
74 | SODIUM_EXPORT
75 | int crypto_box_curve25519xsalsa20poly1305(unsigned char *c,
76 | const unsigned char *m,
77 | unsigned long long mlen,
78 | const unsigned char *n,
79 | const unsigned char *pk,
80 | const unsigned char *sk)
81 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
82 |
83 | SODIUM_EXPORT
84 | int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
85 | const unsigned char *c,
86 | unsigned long long clen,
87 | const unsigned char *n,
88 | const unsigned char *pk,
89 | const unsigned char *sk)
90 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
91 |
92 | SODIUM_EXPORT
93 | int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
94 | const unsigned char *m,
95 | unsigned long long mlen,
96 | const unsigned char *n,
97 | const unsigned char *k)
98 | __attribute__ ((nonnull(1, 4, 5)));
99 |
100 | SODIUM_EXPORT
101 | int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m,
102 | const unsigned char *c,
103 | unsigned long long clen,
104 | const unsigned char *n,
105 | const unsigned char *k)
106 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
107 |
108 | #ifdef __cplusplus
109 | }
110 | #endif
111 |
112 | #endif
113 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_core_ed25519.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_ed25519_H
2 | #define crypto_core_ed25519_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_ed25519_BYTES 32
12 | SODIUM_EXPORT
13 | size_t crypto_core_ed25519_bytes(void);
14 |
15 | #define crypto_core_ed25519_UNIFORMBYTES 32
16 | SODIUM_EXPORT
17 | size_t crypto_core_ed25519_uniformbytes(void);
18 |
19 | #define crypto_core_ed25519_HASHBYTES 64
20 | SODIUM_EXPORT
21 | size_t crypto_core_ed25519_hashbytes(void);
22 |
23 | #define crypto_core_ed25519_SCALARBYTES 32
24 | SODIUM_EXPORT
25 | size_t crypto_core_ed25519_scalarbytes(void);
26 |
27 | #define crypto_core_ed25519_NONREDUCEDSCALARBYTES 64
28 | SODIUM_EXPORT
29 | size_t crypto_core_ed25519_nonreducedscalarbytes(void);
30 |
31 | SODIUM_EXPORT
32 | int crypto_core_ed25519_is_valid_point(const unsigned char *p)
33 | __attribute__ ((nonnull));
34 |
35 | SODIUM_EXPORT
36 | int crypto_core_ed25519_add(unsigned char *r,
37 | const unsigned char *p, const unsigned char *q)
38 | __attribute__ ((nonnull));
39 |
40 | SODIUM_EXPORT
41 | int crypto_core_ed25519_sub(unsigned char *r,
42 | const unsigned char *p, const unsigned char *q)
43 | __attribute__ ((nonnull));
44 |
45 | SODIUM_EXPORT
46 | int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
47 | __attribute__ ((nonnull));
48 |
49 | SODIUM_EXPORT
50 | int crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h)
51 | __attribute__ ((nonnull)) __attribute__ ((deprecated));
52 |
53 | SODIUM_EXPORT
54 | void crypto_core_ed25519_random(unsigned char *p)
55 | __attribute__ ((nonnull));
56 |
57 | SODIUM_EXPORT
58 | void crypto_core_ed25519_scalar_random(unsigned char *r)
59 | __attribute__ ((nonnull));
60 |
61 | SODIUM_EXPORT
62 | int crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s)
63 | __attribute__ ((nonnull));
64 |
65 | SODIUM_EXPORT
66 | void crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
67 | __attribute__ ((nonnull));
68 |
69 | SODIUM_EXPORT
70 | void crypto_core_ed25519_scalar_complement(unsigned char *comp, const unsigned char *s)
71 | __attribute__ ((nonnull));
72 |
73 | SODIUM_EXPORT
74 | void crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
75 | const unsigned char *y)
76 | __attribute__ ((nonnull));
77 |
78 | SODIUM_EXPORT
79 | void crypto_core_ed25519_scalar_sub(unsigned char *z, const unsigned char *x,
80 | const unsigned char *y)
81 | __attribute__ ((nonnull));
82 |
83 | SODIUM_EXPORT
84 | void crypto_core_ed25519_scalar_mul(unsigned char *z, const unsigned char *x,
85 | const unsigned char *y)
86 | __attribute__ ((nonnull));
87 |
88 | /*
89 | * The interval `s` is sampled from should be at least 317 bits to ensure almost
90 | * uniformity of `r` over `L`.
91 | */
92 | SODIUM_EXPORT
93 | void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s)
94 | __attribute__ ((nonnull));
95 |
96 | #ifdef __cplusplus
97 | }
98 | #endif
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_core_hchacha20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_hchacha20_H
2 | #define crypto_core_hchacha20_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_hchacha20_OUTPUTBYTES 32U
12 | SODIUM_EXPORT
13 | size_t crypto_core_hchacha20_outputbytes(void);
14 |
15 | #define crypto_core_hchacha20_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_hchacha20_inputbytes(void);
18 |
19 | #define crypto_core_hchacha20_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_hchacha20_keybytes(void);
22 |
23 | #define crypto_core_hchacha20_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_hchacha20_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c)
30 | __attribute__ ((nonnull(1, 2, 3)));
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_core_hsalsa20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_hsalsa20_H
2 | #define crypto_core_hsalsa20_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_hsalsa20_OUTPUTBYTES 32U
12 | SODIUM_EXPORT
13 | size_t crypto_core_hsalsa20_outputbytes(void);
14 |
15 | #define crypto_core_hsalsa20_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_hsalsa20_inputbytes(void);
18 |
19 | #define crypto_core_hsalsa20_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_hsalsa20_keybytes(void);
22 |
23 | #define crypto_core_hsalsa20_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_hsalsa20_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c)
30 | __attribute__ ((nonnull(1, 2, 3)));
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_core_ristretto255.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_ristretto255_H
2 | #define crypto_core_ristretto255_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_ristretto255_BYTES 32
12 | SODIUM_EXPORT
13 | size_t crypto_core_ristretto255_bytes(void);
14 |
15 | #define crypto_core_ristretto255_HASHBYTES 64
16 | SODIUM_EXPORT
17 | size_t crypto_core_ristretto255_hashbytes(void);
18 |
19 | #define crypto_core_ristretto255_SCALARBYTES 32
20 | SODIUM_EXPORT
21 | size_t crypto_core_ristretto255_scalarbytes(void);
22 |
23 | #define crypto_core_ristretto255_NONREDUCEDSCALARBYTES 64
24 | SODIUM_EXPORT
25 | size_t crypto_core_ristretto255_nonreducedscalarbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_ristretto255_is_valid_point(const unsigned char *p)
29 | __attribute__ ((nonnull));
30 |
31 | SODIUM_EXPORT
32 | int crypto_core_ristretto255_add(unsigned char *r,
33 | const unsigned char *p, const unsigned char *q)
34 | __attribute__ ((nonnull));
35 |
36 | SODIUM_EXPORT
37 | int crypto_core_ristretto255_sub(unsigned char *r,
38 | const unsigned char *p, const unsigned char *q)
39 | __attribute__ ((nonnull));
40 |
41 | SODIUM_EXPORT
42 | int crypto_core_ristretto255_from_hash(unsigned char *p,
43 | const unsigned char *r)
44 | __attribute__ ((nonnull));
45 |
46 | SODIUM_EXPORT
47 | void crypto_core_ristretto255_random(unsigned char *p)
48 | __attribute__ ((nonnull));
49 |
50 | SODIUM_EXPORT
51 | void crypto_core_ristretto255_scalar_random(unsigned char *r)
52 | __attribute__ ((nonnull));
53 |
54 | SODIUM_EXPORT
55 | int crypto_core_ristretto255_scalar_invert(unsigned char *recip,
56 | const unsigned char *s)
57 | __attribute__ ((nonnull));
58 |
59 | SODIUM_EXPORT
60 | void crypto_core_ristretto255_scalar_negate(unsigned char *neg,
61 | const unsigned char *s)
62 | __attribute__ ((nonnull));
63 |
64 | SODIUM_EXPORT
65 | void crypto_core_ristretto255_scalar_complement(unsigned char *comp,
66 | const unsigned char *s)
67 | __attribute__ ((nonnull));
68 |
69 | SODIUM_EXPORT
70 | void crypto_core_ristretto255_scalar_add(unsigned char *z,
71 | const unsigned char *x,
72 | const unsigned char *y)
73 | __attribute__ ((nonnull));
74 |
75 | SODIUM_EXPORT
76 | void crypto_core_ristretto255_scalar_sub(unsigned char *z,
77 | const unsigned char *x,
78 | const unsigned char *y)
79 | __attribute__ ((nonnull));
80 |
81 | SODIUM_EXPORT
82 | void crypto_core_ristretto255_scalar_mul(unsigned char *z,
83 | const unsigned char *x,
84 | const unsigned char *y)
85 | __attribute__ ((nonnull));
86 |
87 | /*
88 | * The interval `s` is sampled from should be at least 317 bits to ensure almost
89 | * uniformity of `r` over `L`.
90 | */
91 | SODIUM_EXPORT
92 | void crypto_core_ristretto255_scalar_reduce(unsigned char *r,
93 | const unsigned char *s)
94 | __attribute__ ((nonnull));
95 |
96 | #ifdef __cplusplus
97 | }
98 | #endif
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_core_salsa20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_salsa20_H
2 | #define crypto_core_salsa20_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_salsa20_OUTPUTBYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_core_salsa20_outputbytes(void);
14 |
15 | #define crypto_core_salsa20_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_salsa20_inputbytes(void);
18 |
19 | #define crypto_core_salsa20_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_salsa20_keybytes(void);
22 |
23 | #define crypto_core_salsa20_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_salsa20_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_salsa20(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c)
30 | __attribute__ ((nonnull(1, 2, 3)));
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_core_salsa2012.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_salsa2012_H
2 | #define crypto_core_salsa2012_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_salsa2012_OUTPUTBYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_core_salsa2012_outputbytes(void);
14 |
15 | #define crypto_core_salsa2012_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_salsa2012_inputbytes(void);
18 |
19 | #define crypto_core_salsa2012_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_salsa2012_keybytes(void);
22 |
23 | #define crypto_core_salsa2012_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_salsa2012_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c)
30 | __attribute__ ((nonnull(1, 2, 3)));
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_core_salsa208.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_salsa208_H
2 | #define crypto_core_salsa208_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_salsa208_OUTPUTBYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_core_salsa208_outputbytes(void)
14 | __attribute__ ((deprecated));
15 |
16 | #define crypto_core_salsa208_INPUTBYTES 16U
17 | SODIUM_EXPORT
18 | size_t crypto_core_salsa208_inputbytes(void)
19 | __attribute__ ((deprecated));
20 |
21 | #define crypto_core_salsa208_KEYBYTES 32U
22 | SODIUM_EXPORT
23 | size_t crypto_core_salsa208_keybytes(void)
24 | __attribute__ ((deprecated));
25 |
26 | #define crypto_core_salsa208_CONSTBYTES 16U
27 | SODIUM_EXPORT
28 | size_t crypto_core_salsa208_constbytes(void)
29 | __attribute__ ((deprecated));
30 |
31 | SODIUM_EXPORT
32 | int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
33 | const unsigned char *k, const unsigned char *c)
34 | __attribute__ ((nonnull(1, 2, 3)));
35 |
36 | #ifdef __cplusplus
37 | }
38 | #endif
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_generichash.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_generichash_H
2 | #define crypto_generichash_H
3 |
4 | #include
5 |
6 | #include "crypto_generichash_blake2b.h"
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | # ifdef __GNUC__
11 | # pragma GCC diagnostic ignored "-Wlong-long"
12 | # endif
13 | extern "C" {
14 | #endif
15 |
16 | #define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN
17 | SODIUM_EXPORT
18 | size_t crypto_generichash_bytes_min(void);
19 |
20 | #define crypto_generichash_BYTES_MAX crypto_generichash_blake2b_BYTES_MAX
21 | SODIUM_EXPORT
22 | size_t crypto_generichash_bytes_max(void);
23 |
24 | #define crypto_generichash_BYTES crypto_generichash_blake2b_BYTES
25 | SODIUM_EXPORT
26 | size_t crypto_generichash_bytes(void);
27 |
28 | #define crypto_generichash_KEYBYTES_MIN crypto_generichash_blake2b_KEYBYTES_MIN
29 | SODIUM_EXPORT
30 | size_t crypto_generichash_keybytes_min(void);
31 |
32 | #define crypto_generichash_KEYBYTES_MAX crypto_generichash_blake2b_KEYBYTES_MAX
33 | SODIUM_EXPORT
34 | size_t crypto_generichash_keybytes_max(void);
35 |
36 | #define crypto_generichash_KEYBYTES crypto_generichash_blake2b_KEYBYTES
37 | SODIUM_EXPORT
38 | size_t crypto_generichash_keybytes(void);
39 |
40 | #define crypto_generichash_PRIMITIVE "blake2b"
41 | SODIUM_EXPORT
42 | const char *crypto_generichash_primitive(void);
43 |
44 | /*
45 | * Important when writing bindings for other programming languages:
46 | * the state address should be 64-bytes aligned.
47 | */
48 | typedef crypto_generichash_blake2b_state crypto_generichash_state;
49 |
50 | SODIUM_EXPORT
51 | size_t crypto_generichash_statebytes(void);
52 |
53 | SODIUM_EXPORT
54 | int crypto_generichash(unsigned char *out, size_t outlen,
55 | const unsigned char *in, unsigned long long inlen,
56 | const unsigned char *key, size_t keylen)
57 | __attribute__ ((nonnull(1)));
58 |
59 | SODIUM_EXPORT
60 | int crypto_generichash_init(crypto_generichash_state *state,
61 | const unsigned char *key,
62 | const size_t keylen, const size_t outlen)
63 | __attribute__ ((nonnull(1)));
64 |
65 | SODIUM_EXPORT
66 | int crypto_generichash_update(crypto_generichash_state *state,
67 | const unsigned char *in,
68 | unsigned long long inlen)
69 | __attribute__ ((nonnull(1)));
70 |
71 | SODIUM_EXPORT
72 | int crypto_generichash_final(crypto_generichash_state *state,
73 | unsigned char *out, const size_t outlen)
74 | __attribute__ ((nonnull));
75 |
76 | SODIUM_EXPORT
77 | void crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES])
78 | __attribute__ ((nonnull));
79 |
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 |
84 | #endif
85 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_generichash_blake2b.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_generichash_blake2b_H
2 | #define crypto_generichash_blake2b_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "export.h"
9 |
10 | #ifdef __cplusplus
11 | # ifdef __GNUC__
12 | # pragma GCC diagnostic ignored "-Wlong-long"
13 | # endif
14 | extern "C" {
15 | #endif
16 |
17 | #ifdef __IBMC__
18 | # pragma pack(1)
19 | #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
20 | # pragma pack(1)
21 | #else
22 | # pragma pack(push, 1)
23 | #endif
24 |
25 | typedef struct CRYPTO_ALIGN(64) crypto_generichash_blake2b_state {
26 | unsigned char opaque[384];
27 | } crypto_generichash_blake2b_state;
28 |
29 | #ifdef __IBMC__
30 | # pragma pack(pop)
31 | #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
32 | # pragma pack()
33 | #else
34 | # pragma pack(pop)
35 | #endif
36 |
37 | #define crypto_generichash_blake2b_BYTES_MIN 16U
38 | SODIUM_EXPORT
39 | size_t crypto_generichash_blake2b_bytes_min(void);
40 |
41 | #define crypto_generichash_blake2b_BYTES_MAX 64U
42 | SODIUM_EXPORT
43 | size_t crypto_generichash_blake2b_bytes_max(void);
44 |
45 | #define crypto_generichash_blake2b_BYTES 32U
46 | SODIUM_EXPORT
47 | size_t crypto_generichash_blake2b_bytes(void);
48 |
49 | #define crypto_generichash_blake2b_KEYBYTES_MIN 16U
50 | SODIUM_EXPORT
51 | size_t crypto_generichash_blake2b_keybytes_min(void);
52 |
53 | #define crypto_generichash_blake2b_KEYBYTES_MAX 64U
54 | SODIUM_EXPORT
55 | size_t crypto_generichash_blake2b_keybytes_max(void);
56 |
57 | #define crypto_generichash_blake2b_KEYBYTES 32U
58 | SODIUM_EXPORT
59 | size_t crypto_generichash_blake2b_keybytes(void);
60 |
61 | #define crypto_generichash_blake2b_SALTBYTES 16U
62 | SODIUM_EXPORT
63 | size_t crypto_generichash_blake2b_saltbytes(void);
64 |
65 | #define crypto_generichash_blake2b_PERSONALBYTES 16U
66 | SODIUM_EXPORT
67 | size_t crypto_generichash_blake2b_personalbytes(void);
68 |
69 | SODIUM_EXPORT
70 | size_t crypto_generichash_blake2b_statebytes(void);
71 |
72 | SODIUM_EXPORT
73 | int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
74 | const unsigned char *in,
75 | unsigned long long inlen,
76 | const unsigned char *key, size_t keylen)
77 | __attribute__ ((nonnull(1)));
78 |
79 | SODIUM_EXPORT
80 | int crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
81 | const unsigned char *in,
82 | unsigned long long inlen,
83 | const unsigned char *key,
84 | size_t keylen,
85 | const unsigned char *salt,
86 | const unsigned char *personal)
87 | __attribute__ ((nonnull(1)));
88 |
89 | SODIUM_EXPORT
90 | int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
91 | const unsigned char *key,
92 | const size_t keylen, const size_t outlen)
93 | __attribute__ ((nonnull(1)));
94 |
95 | SODIUM_EXPORT
96 | int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *state,
97 | const unsigned char *key,
98 | const size_t keylen, const size_t outlen,
99 | const unsigned char *salt,
100 | const unsigned char *personal)
101 | __attribute__ ((nonnull(1)));
102 |
103 | SODIUM_EXPORT
104 | int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
105 | const unsigned char *in,
106 | unsigned long long inlen)
107 | __attribute__ ((nonnull(1)));
108 |
109 | SODIUM_EXPORT
110 | int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
111 | unsigned char *out,
112 | const size_t outlen) __attribute__ ((nonnull));
113 |
114 | SODIUM_EXPORT
115 | void crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES])
116 | __attribute__ ((nonnull));
117 |
118 | #ifdef __cplusplus
119 | }
120 | #endif
121 |
122 | #endif
123 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_hash.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_hash_H
2 | #define crypto_hash_H
3 |
4 | /*
5 | * WARNING: Unless you absolutely need to use SHA512 for interoperability,
6 | * purposes, you might want to consider crypto_generichash() instead.
7 | * Unlike SHA512, crypto_generichash() is not vulnerable to length
8 | * extension attacks.
9 | */
10 |
11 | #include
12 |
13 | #include "crypto_hash_sha512.h"
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | # ifdef __GNUC__
18 | # pragma GCC diagnostic ignored "-Wlong-long"
19 | # endif
20 | extern "C" {
21 | #endif
22 |
23 | #define crypto_hash_BYTES crypto_hash_sha512_BYTES
24 | SODIUM_EXPORT
25 | size_t crypto_hash_bytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_hash(unsigned char *out, const unsigned char *in,
29 | unsigned long long inlen) __attribute__ ((nonnull(1)));
30 |
31 | #define crypto_hash_PRIMITIVE "sha512"
32 | SODIUM_EXPORT
33 | const char *crypto_hash_primitive(void)
34 | __attribute__ ((warn_unused_result));
35 |
36 | #ifdef __cplusplus
37 | }
38 | #endif
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_hash_sha256.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_hash_sha256_H
2 | #define crypto_hash_sha256_H
3 |
4 | /*
5 | * WARNING: Unless you absolutely need to use SHA256 for interoperability,
6 | * purposes, you might want to consider crypto_generichash() instead.
7 | * Unlike SHA256, crypto_generichash() is not vulnerable to length
8 | * extension attacks.
9 | */
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #include "export.h"
16 |
17 | #ifdef __cplusplus
18 | # ifdef __GNUC__
19 | # pragma GCC diagnostic ignored "-Wlong-long"
20 | # endif
21 | extern "C" {
22 | #endif
23 |
24 | typedef struct crypto_hash_sha256_state {
25 | uint32_t state[8];
26 | uint64_t count;
27 | uint8_t buf[64];
28 | } crypto_hash_sha256_state;
29 |
30 | SODIUM_EXPORT
31 | size_t crypto_hash_sha256_statebytes(void);
32 |
33 | #define crypto_hash_sha256_BYTES 32U
34 | SODIUM_EXPORT
35 | size_t crypto_hash_sha256_bytes(void);
36 |
37 | SODIUM_EXPORT
38 | int crypto_hash_sha256(unsigned char *out, const unsigned char *in,
39 | unsigned long long inlen) __attribute__ ((nonnull(1)));
40 |
41 | SODIUM_EXPORT
42 | int crypto_hash_sha256_init(crypto_hash_sha256_state *state)
43 | __attribute__ ((nonnull));
44 |
45 | SODIUM_EXPORT
46 | int crypto_hash_sha256_update(crypto_hash_sha256_state *state,
47 | const unsigned char *in,
48 | unsigned long long inlen)
49 | __attribute__ ((nonnull(1)));
50 |
51 | SODIUM_EXPORT
52 | int crypto_hash_sha256_final(crypto_hash_sha256_state *state,
53 | unsigned char *out)
54 | __attribute__ ((nonnull));
55 |
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_hash_sha512.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_hash_sha512_H
2 | #define crypto_hash_sha512_H
3 |
4 | /*
5 | * WARNING: Unless you absolutely need to use SHA512 for interoperability,
6 | * purposes, you might want to consider crypto_generichash() instead.
7 | * Unlike SHA512, crypto_generichash() is not vulnerable to length
8 | * extension attacks.
9 | */
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #include "export.h"
16 |
17 | #ifdef __cplusplus
18 | # ifdef __GNUC__
19 | # pragma GCC diagnostic ignored "-Wlong-long"
20 | # endif
21 | extern "C" {
22 | #endif
23 |
24 | typedef struct crypto_hash_sha512_state {
25 | uint64_t state[8];
26 | uint64_t count[2];
27 | uint8_t buf[128];
28 | } crypto_hash_sha512_state;
29 |
30 | SODIUM_EXPORT
31 | size_t crypto_hash_sha512_statebytes(void);
32 |
33 | #define crypto_hash_sha512_BYTES 64U
34 | SODIUM_EXPORT
35 | size_t crypto_hash_sha512_bytes(void);
36 |
37 | SODIUM_EXPORT
38 | int crypto_hash_sha512(unsigned char *out, const unsigned char *in,
39 | unsigned long long inlen) __attribute__ ((nonnull(1)));
40 |
41 | SODIUM_EXPORT
42 | int crypto_hash_sha512_init(crypto_hash_sha512_state *state)
43 | __attribute__ ((nonnull));
44 |
45 | SODIUM_EXPORT
46 | int crypto_hash_sha512_update(crypto_hash_sha512_state *state,
47 | const unsigned char *in,
48 | unsigned long long inlen)
49 | __attribute__ ((nonnull(1)));
50 |
51 | SODIUM_EXPORT
52 | int crypto_hash_sha512_final(crypto_hash_sha512_state *state,
53 | unsigned char *out)
54 | __attribute__ ((nonnull));
55 |
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_kdf.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_kdf_H
2 | #define crypto_kdf_H
3 |
4 | #include
5 | #include
6 |
7 | #include "crypto_kdf_blake2b.h"
8 | #include "export.h"
9 |
10 | #ifdef __cplusplus
11 | # ifdef __GNUC__
12 | # pragma GCC diagnostic ignored "-Wlong-long"
13 | # endif
14 | extern "C" {
15 | #endif
16 |
17 | #define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN
18 | SODIUM_EXPORT
19 | size_t crypto_kdf_bytes_min(void);
20 |
21 | #define crypto_kdf_BYTES_MAX crypto_kdf_blake2b_BYTES_MAX
22 | SODIUM_EXPORT
23 | size_t crypto_kdf_bytes_max(void);
24 |
25 | #define crypto_kdf_CONTEXTBYTES crypto_kdf_blake2b_CONTEXTBYTES
26 | SODIUM_EXPORT
27 | size_t crypto_kdf_contextbytes(void);
28 |
29 | #define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES
30 | SODIUM_EXPORT
31 | size_t crypto_kdf_keybytes(void);
32 |
33 | #define crypto_kdf_PRIMITIVE "blake2b"
34 | SODIUM_EXPORT
35 | const char *crypto_kdf_primitive(void)
36 | __attribute__ ((warn_unused_result));
37 |
38 | SODIUM_EXPORT
39 | int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len,
40 | uint64_t subkey_id,
41 | const char ctx[crypto_kdf_CONTEXTBYTES],
42 | const unsigned char key[crypto_kdf_KEYBYTES])
43 | __attribute__ ((nonnull));
44 |
45 | SODIUM_EXPORT
46 | void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES])
47 | __attribute__ ((nonnull));
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_kdf_blake2b.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_kdf_blake2b_H
2 | #define crypto_kdf_blake2b_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "export.h"
9 |
10 | #ifdef __cplusplus
11 | # ifdef __GNUC__
12 | # pragma GCC diagnostic ignored "-Wlong-long"
13 | # endif
14 | extern "C" {
15 | #endif
16 |
17 | #define crypto_kdf_blake2b_BYTES_MIN 16
18 | SODIUM_EXPORT
19 | size_t crypto_kdf_blake2b_bytes_min(void);
20 |
21 | #define crypto_kdf_blake2b_BYTES_MAX 64
22 | SODIUM_EXPORT
23 | size_t crypto_kdf_blake2b_bytes_max(void);
24 |
25 | #define crypto_kdf_blake2b_CONTEXTBYTES 8
26 | SODIUM_EXPORT
27 | size_t crypto_kdf_blake2b_contextbytes(void);
28 |
29 | #define crypto_kdf_blake2b_KEYBYTES 32
30 | SODIUM_EXPORT
31 | size_t crypto_kdf_blake2b_keybytes(void);
32 |
33 | SODIUM_EXPORT
34 | int crypto_kdf_blake2b_derive_from_key(unsigned char *subkey, size_t subkey_len,
35 | uint64_t subkey_id,
36 | const char ctx[crypto_kdf_blake2b_CONTEXTBYTES],
37 | const unsigned char key[crypto_kdf_blake2b_KEYBYTES])
38 | __attribute__ ((nonnull));
39 |
40 | #ifdef __cplusplus
41 | }
42 | #endif
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_kdf_hkdf_sha256.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_kdf_hkdf_sha256_H
2 | #define crypto_kdf_hkdf_sha256_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "crypto_kdf.h"
9 | #include "crypto_auth_hmacsha256.h"
10 | #include "export.h"
11 |
12 | #ifdef __cplusplus
13 | # ifdef __GNUC__
14 | # pragma GCC diagnostic ignored "-Wlong-long"
15 | # endif
16 | extern "C" {
17 | #endif
18 |
19 | #define crypto_kdf_hkdf_sha256_KEYBYTES crypto_auth_hmacsha256_BYTES
20 | SODIUM_EXPORT
21 | size_t crypto_kdf_hkdf_sha256_keybytes(void);
22 |
23 | #define crypto_kdf_hkdf_sha256_BYTES_MIN 0U
24 | SODIUM_EXPORT
25 | size_t crypto_kdf_hkdf_sha256_bytes_min(void);
26 |
27 | #define crypto_kdf_hkdf_sha256_BYTES_MAX (0xff * crypto_auth_hmacsha256_BYTES)
28 | SODIUM_EXPORT
29 | size_t crypto_kdf_hkdf_sha256_bytes_max(void);
30 |
31 | SODIUM_EXPORT
32 | int crypto_kdf_hkdf_sha256_extract(unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES],
33 | const unsigned char *salt, size_t salt_len,
34 | const unsigned char *ikm, size_t ikm_len)
35 | __attribute__ ((nonnull(4)));
36 |
37 | SODIUM_EXPORT
38 | void crypto_kdf_hkdf_sha256_keygen(unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES]);
39 |
40 | SODIUM_EXPORT
41 | int crypto_kdf_hkdf_sha256_expand(unsigned char *out, size_t out_len,
42 | const char *ctx, size_t ctx_len,
43 | const unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES])
44 | __attribute__ ((nonnull(1)));
45 |
46 | /* ------------------------------------------------------------------------- */
47 |
48 | typedef struct crypto_kdf_hkdf_sha256_state {
49 | crypto_auth_hmacsha256_state st;
50 | } crypto_kdf_hkdf_sha256_state;
51 |
52 | SODIUM_EXPORT
53 | size_t crypto_kdf_hkdf_sha256_statebytes(void);
54 |
55 | SODIUM_EXPORT
56 | int crypto_kdf_hkdf_sha256_extract_init(crypto_kdf_hkdf_sha256_state *state,
57 | const unsigned char *salt, size_t salt_len)
58 | __attribute__ ((nonnull(1)));
59 |
60 | SODIUM_EXPORT
61 | int crypto_kdf_hkdf_sha256_extract_update(crypto_kdf_hkdf_sha256_state *state,
62 | const unsigned char *ikm, size_t ikm_len)
63 | __attribute__ ((nonnull));
64 |
65 | SODIUM_EXPORT
66 | int crypto_kdf_hkdf_sha256_extract_final(crypto_kdf_hkdf_sha256_state *state,
67 | unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES])
68 | __attribute__ ((nonnull));
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_kdf_hkdf_sha512.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_kdf_hkdf_sha512_H
2 | #define crypto_kdf_hkdf_sha512_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "crypto_kdf.h"
9 | #include "crypto_auth_hmacsha512.h"
10 | #include "export.h"
11 |
12 | #ifdef __cplusplus
13 | # ifdef __GNUC__
14 | # pragma GCC diagnostic ignored "-Wlong-long"
15 | # endif
16 | extern "C" {
17 | #endif
18 |
19 | #define crypto_kdf_hkdf_sha512_KEYBYTES crypto_auth_hmacsha512_BYTES
20 | SODIUM_EXPORT
21 | size_t crypto_kdf_hkdf_sha512_keybytes(void);
22 |
23 | #define crypto_kdf_hkdf_sha512_BYTES_MIN 0U
24 | SODIUM_EXPORT
25 | size_t crypto_kdf_hkdf_sha512_bytes_min(void);
26 |
27 | #define crypto_kdf_hkdf_sha512_BYTES_MAX (0xff * crypto_auth_hmacsha512_BYTES)
28 | SODIUM_EXPORT
29 | size_t crypto_kdf_hkdf_sha512_bytes_max(void);
30 |
31 | SODIUM_EXPORT
32 | int crypto_kdf_hkdf_sha512_extract(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES],
33 | const unsigned char *salt, size_t salt_len,
34 | const unsigned char *ikm, size_t ikm_len)
35 | __attribute__ ((nonnull(1)));
36 |
37 | SODIUM_EXPORT
38 | void crypto_kdf_hkdf_sha512_keygen(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
39 | __attribute__ ((nonnull));
40 |
41 | SODIUM_EXPORT
42 | int crypto_kdf_hkdf_sha512_expand(unsigned char *out, size_t out_len,
43 | const char *ctx, size_t ctx_len,
44 | const unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
45 | __attribute__ ((nonnull(1)));
46 |
47 | /* ------------------------------------------------------------------------- */
48 |
49 | typedef struct crypto_kdf_hkdf_sha512_state {
50 | crypto_auth_hmacsha512_state st;
51 | } crypto_kdf_hkdf_sha512_state;
52 |
53 | SODIUM_EXPORT
54 | size_t crypto_kdf_hkdf_sha512_statebytes(void);
55 |
56 | SODIUM_EXPORT
57 | int crypto_kdf_hkdf_sha512_extract_init(crypto_kdf_hkdf_sha512_state *state,
58 | const unsigned char *salt, size_t salt_len)
59 | __attribute__ ((nonnull(1)));
60 |
61 | SODIUM_EXPORT
62 | int crypto_kdf_hkdf_sha512_extract_update(crypto_kdf_hkdf_sha512_state *state,
63 | const unsigned char *ikm, size_t ikm_len)
64 | __attribute__ ((nonnull));
65 |
66 | SODIUM_EXPORT
67 | int crypto_kdf_hkdf_sha512_extract_final(crypto_kdf_hkdf_sha512_state *state,
68 | unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
69 | __attribute__ ((nonnull));
70 |
71 | #ifdef __cplusplus
72 | }
73 | #endif
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_kx.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_kx_H
2 | #define crypto_kx_H
3 |
4 | #include
5 |
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_kx_PUBLICKEYBYTES 32
16 | SODIUM_EXPORT
17 | size_t crypto_kx_publickeybytes(void);
18 |
19 | #define crypto_kx_SECRETKEYBYTES 32
20 | SODIUM_EXPORT
21 | size_t crypto_kx_secretkeybytes(void);
22 |
23 | #define crypto_kx_SEEDBYTES 32
24 | SODIUM_EXPORT
25 | size_t crypto_kx_seedbytes(void);
26 |
27 | #define crypto_kx_SESSIONKEYBYTES 32
28 | SODIUM_EXPORT
29 | size_t crypto_kx_sessionkeybytes(void);
30 |
31 | #define crypto_kx_PRIMITIVE "x25519blake2b"
32 | SODIUM_EXPORT
33 | const char *crypto_kx_primitive(void);
34 |
35 | SODIUM_EXPORT
36 | int crypto_kx_seed_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
37 | unsigned char sk[crypto_kx_SECRETKEYBYTES],
38 | const unsigned char seed[crypto_kx_SEEDBYTES])
39 | __attribute__ ((nonnull));
40 |
41 | SODIUM_EXPORT
42 | int crypto_kx_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
43 | unsigned char sk[crypto_kx_SECRETKEYBYTES])
44 | __attribute__ ((nonnull));
45 |
46 | SODIUM_EXPORT
47 | int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
48 | unsigned char tx[crypto_kx_SESSIONKEYBYTES],
49 | const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES],
50 | const unsigned char client_sk[crypto_kx_SECRETKEYBYTES],
51 | const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES])
52 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 4, 5)));
53 |
54 | SODIUM_EXPORT
55 | int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
56 | unsigned char tx[crypto_kx_SESSIONKEYBYTES],
57 | const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES],
58 | const unsigned char server_sk[crypto_kx_SECRETKEYBYTES],
59 | const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES])
60 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 4, 5)));
61 |
62 | #ifdef __cplusplus
63 | }
64 | #endif
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_onetimeauth.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_onetimeauth_H
2 | #define crypto_onetimeauth_H
3 |
4 | #include
5 |
6 | #include "crypto_onetimeauth_poly1305.h"
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | # ifdef __GNUC__
11 | # pragma GCC diagnostic ignored "-Wlong-long"
12 | # endif
13 | extern "C" {
14 | #endif
15 |
16 | typedef crypto_onetimeauth_poly1305_state crypto_onetimeauth_state;
17 |
18 | SODIUM_EXPORT
19 | size_t crypto_onetimeauth_statebytes(void);
20 |
21 | #define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES
22 | SODIUM_EXPORT
23 | size_t crypto_onetimeauth_bytes(void);
24 |
25 | #define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES
26 | SODIUM_EXPORT
27 | size_t crypto_onetimeauth_keybytes(void);
28 |
29 | #define crypto_onetimeauth_PRIMITIVE "poly1305"
30 | SODIUM_EXPORT
31 | const char *crypto_onetimeauth_primitive(void);
32 |
33 | SODIUM_EXPORT
34 | int crypto_onetimeauth(unsigned char *out, const unsigned char *in,
35 | unsigned long long inlen, const unsigned char *k)
36 | __attribute__ ((nonnull(1, 4)));
37 |
38 | SODIUM_EXPORT
39 | int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
40 | unsigned long long inlen, const unsigned char *k)
41 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
42 |
43 | SODIUM_EXPORT
44 | int crypto_onetimeauth_init(crypto_onetimeauth_state *state,
45 | const unsigned char *key) __attribute__ ((nonnull));
46 |
47 | SODIUM_EXPORT
48 | int crypto_onetimeauth_update(crypto_onetimeauth_state *state,
49 | const unsigned char *in,
50 | unsigned long long inlen)
51 | __attribute__ ((nonnull(1)));
52 |
53 | SODIUM_EXPORT
54 | int crypto_onetimeauth_final(crypto_onetimeauth_state *state,
55 | unsigned char *out) __attribute__ ((nonnull));
56 |
57 | SODIUM_EXPORT
58 | void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES])
59 | __attribute__ ((nonnull));
60 |
61 | #ifdef __cplusplus
62 | }
63 | #endif
64 |
65 | #endif
66 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_onetimeauth_poly1305.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_onetimeauth_poly1305_H
2 | #define crypto_onetimeauth_poly1305_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | #include "export.h"
11 |
12 | #ifdef __cplusplus
13 | # ifdef __GNUC__
14 | # pragma GCC diagnostic ignored "-Wlong-long"
15 | # endif
16 | extern "C" {
17 | #endif
18 |
19 | typedef struct CRYPTO_ALIGN(16) crypto_onetimeauth_poly1305_state {
20 | unsigned char opaque[256];
21 | } crypto_onetimeauth_poly1305_state;
22 |
23 | SODIUM_EXPORT
24 | size_t crypto_onetimeauth_poly1305_statebytes(void);
25 |
26 | #define crypto_onetimeauth_poly1305_BYTES 16U
27 | SODIUM_EXPORT
28 | size_t crypto_onetimeauth_poly1305_bytes(void);
29 |
30 | #define crypto_onetimeauth_poly1305_KEYBYTES 32U
31 | SODIUM_EXPORT
32 | size_t crypto_onetimeauth_poly1305_keybytes(void);
33 |
34 | SODIUM_EXPORT
35 | int crypto_onetimeauth_poly1305(unsigned char *out,
36 | const unsigned char *in,
37 | unsigned long long inlen,
38 | const unsigned char *k)
39 | __attribute__ ((nonnull(1, 4)));
40 |
41 | SODIUM_EXPORT
42 | int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
43 | const unsigned char *in,
44 | unsigned long long inlen,
45 | const unsigned char *k)
46 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
47 |
48 | SODIUM_EXPORT
49 | int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
50 | const unsigned char *key)
51 | __attribute__ ((nonnull));
52 |
53 | SODIUM_EXPORT
54 | int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
55 | const unsigned char *in,
56 | unsigned long long inlen)
57 | __attribute__ ((nonnull(1)));
58 |
59 | SODIUM_EXPORT
60 | int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
61 | unsigned char *out)
62 | __attribute__ ((nonnull));
63 |
64 | SODIUM_EXPORT
65 | void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES])
66 | __attribute__ ((nonnull));
67 |
68 | #ifdef __cplusplus
69 | }
70 | #endif
71 |
72 | #endif
73 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_pwhash_argon2i.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_pwhash_argon2i_H
2 | #define crypto_pwhash_argon2i_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "export.h"
9 |
10 | #ifdef __cplusplus
11 | # ifdef __GNUC__
12 | # pragma GCC diagnostic ignored "-Wlong-long"
13 | # endif
14 | extern "C" {
15 | #endif
16 |
17 | #define crypto_pwhash_argon2i_ALG_ARGON2I13 1
18 | SODIUM_EXPORT
19 | int crypto_pwhash_argon2i_alg_argon2i13(void);
20 |
21 | #define crypto_pwhash_argon2i_BYTES_MIN 16U
22 | SODIUM_EXPORT
23 | size_t crypto_pwhash_argon2i_bytes_min(void);
24 |
25 | #define crypto_pwhash_argon2i_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
26 | SODIUM_EXPORT
27 | size_t crypto_pwhash_argon2i_bytes_max(void);
28 |
29 | #define crypto_pwhash_argon2i_PASSWD_MIN 0U
30 | SODIUM_EXPORT
31 | size_t crypto_pwhash_argon2i_passwd_min(void);
32 |
33 | #define crypto_pwhash_argon2i_PASSWD_MAX 4294967295U
34 | SODIUM_EXPORT
35 | size_t crypto_pwhash_argon2i_passwd_max(void);
36 |
37 | #define crypto_pwhash_argon2i_SALTBYTES 16U
38 | SODIUM_EXPORT
39 | size_t crypto_pwhash_argon2i_saltbytes(void);
40 |
41 | #define crypto_pwhash_argon2i_STRBYTES 128U
42 | SODIUM_EXPORT
43 | size_t crypto_pwhash_argon2i_strbytes(void);
44 |
45 | #define crypto_pwhash_argon2i_STRPREFIX "$argon2i$"
46 | SODIUM_EXPORT
47 | const char *crypto_pwhash_argon2i_strprefix(void);
48 |
49 | #define crypto_pwhash_argon2i_OPSLIMIT_MIN 3U
50 | SODIUM_EXPORT
51 | size_t crypto_pwhash_argon2i_opslimit_min(void);
52 |
53 | #define crypto_pwhash_argon2i_OPSLIMIT_MAX 4294967295U
54 | SODIUM_EXPORT
55 | size_t crypto_pwhash_argon2i_opslimit_max(void);
56 |
57 | #define crypto_pwhash_argon2i_MEMLIMIT_MIN 8192U
58 | SODIUM_EXPORT
59 | size_t crypto_pwhash_argon2i_memlimit_min(void);
60 |
61 | #define crypto_pwhash_argon2i_MEMLIMIT_MAX \
62 | ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
63 | SODIUM_EXPORT
64 | size_t crypto_pwhash_argon2i_memlimit_max(void);
65 |
66 | #define crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 4U
67 | SODIUM_EXPORT
68 | size_t crypto_pwhash_argon2i_opslimit_interactive(void);
69 |
70 | #define crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 33554432U
71 | SODIUM_EXPORT
72 | size_t crypto_pwhash_argon2i_memlimit_interactive(void);
73 |
74 | #define crypto_pwhash_argon2i_OPSLIMIT_MODERATE 6U
75 | SODIUM_EXPORT
76 | size_t crypto_pwhash_argon2i_opslimit_moderate(void);
77 |
78 | #define crypto_pwhash_argon2i_MEMLIMIT_MODERATE 134217728U
79 | SODIUM_EXPORT
80 | size_t crypto_pwhash_argon2i_memlimit_moderate(void);
81 |
82 | #define crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 8U
83 | SODIUM_EXPORT
84 | size_t crypto_pwhash_argon2i_opslimit_sensitive(void);
85 |
86 | #define crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 536870912U
87 | SODIUM_EXPORT
88 | size_t crypto_pwhash_argon2i_memlimit_sensitive(void);
89 |
90 | SODIUM_EXPORT
91 | int crypto_pwhash_argon2i(unsigned char * const out,
92 | unsigned long long outlen,
93 | const char * const passwd,
94 | unsigned long long passwdlen,
95 | const unsigned char * const salt,
96 | unsigned long long opslimit, size_t memlimit,
97 | int alg)
98 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
99 |
100 | SODIUM_EXPORT
101 | int crypto_pwhash_argon2i_str(char out[crypto_pwhash_argon2i_STRBYTES],
102 | const char * const passwd,
103 | unsigned long long passwdlen,
104 | unsigned long long opslimit, size_t memlimit)
105 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
106 |
107 | SODIUM_EXPORT
108 | int crypto_pwhash_argon2i_str_verify(const char * str,
109 | const char * const passwd,
110 | unsigned long long passwdlen)
111 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
112 |
113 | SODIUM_EXPORT
114 | int crypto_pwhash_argon2i_str_needs_rehash(const char * str,
115 | unsigned long long opslimit, size_t memlimit)
116 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
117 |
118 | #ifdef __cplusplus
119 | }
120 | #endif
121 |
122 | #endif
123 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_pwhash_argon2id.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_pwhash_argon2id_H
2 | #define crypto_pwhash_argon2id_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "export.h"
9 |
10 | #ifdef __cplusplus
11 | # ifdef __GNUC__
12 | # pragma GCC diagnostic ignored "-Wlong-long"
13 | # endif
14 | extern "C" {
15 | #endif
16 |
17 | #define crypto_pwhash_argon2id_ALG_ARGON2ID13 2
18 | SODIUM_EXPORT
19 | int crypto_pwhash_argon2id_alg_argon2id13(void);
20 |
21 | #define crypto_pwhash_argon2id_BYTES_MIN 16U
22 | SODIUM_EXPORT
23 | size_t crypto_pwhash_argon2id_bytes_min(void);
24 |
25 | #define crypto_pwhash_argon2id_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
26 | SODIUM_EXPORT
27 | size_t crypto_pwhash_argon2id_bytes_max(void);
28 |
29 | #define crypto_pwhash_argon2id_PASSWD_MIN 0U
30 | SODIUM_EXPORT
31 | size_t crypto_pwhash_argon2id_passwd_min(void);
32 |
33 | #define crypto_pwhash_argon2id_PASSWD_MAX 4294967295U
34 | SODIUM_EXPORT
35 | size_t crypto_pwhash_argon2id_passwd_max(void);
36 |
37 | #define crypto_pwhash_argon2id_SALTBYTES 16U
38 | SODIUM_EXPORT
39 | size_t crypto_pwhash_argon2id_saltbytes(void);
40 |
41 | #define crypto_pwhash_argon2id_STRBYTES 128U
42 | SODIUM_EXPORT
43 | size_t crypto_pwhash_argon2id_strbytes(void);
44 |
45 | #define crypto_pwhash_argon2id_STRPREFIX "$argon2id$"
46 | SODIUM_EXPORT
47 | const char *crypto_pwhash_argon2id_strprefix(void);
48 |
49 | #define crypto_pwhash_argon2id_OPSLIMIT_MIN 1U
50 | SODIUM_EXPORT
51 | size_t crypto_pwhash_argon2id_opslimit_min(void);
52 |
53 | #define crypto_pwhash_argon2id_OPSLIMIT_MAX 4294967295U
54 | SODIUM_EXPORT
55 | size_t crypto_pwhash_argon2id_opslimit_max(void);
56 |
57 | #define crypto_pwhash_argon2id_MEMLIMIT_MIN 8192U
58 | SODIUM_EXPORT
59 | size_t crypto_pwhash_argon2id_memlimit_min(void);
60 |
61 | #define crypto_pwhash_argon2id_MEMLIMIT_MAX \
62 | ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
63 | SODIUM_EXPORT
64 | size_t crypto_pwhash_argon2id_memlimit_max(void);
65 |
66 | #define crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 2U
67 | SODIUM_EXPORT
68 | size_t crypto_pwhash_argon2id_opslimit_interactive(void);
69 |
70 | #define crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 67108864U
71 | SODIUM_EXPORT
72 | size_t crypto_pwhash_argon2id_memlimit_interactive(void);
73 |
74 | #define crypto_pwhash_argon2id_OPSLIMIT_MODERATE 3U
75 | SODIUM_EXPORT
76 | size_t crypto_pwhash_argon2id_opslimit_moderate(void);
77 |
78 | #define crypto_pwhash_argon2id_MEMLIMIT_MODERATE 268435456U
79 | SODIUM_EXPORT
80 | size_t crypto_pwhash_argon2id_memlimit_moderate(void);
81 |
82 | #define crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 4U
83 | SODIUM_EXPORT
84 | size_t crypto_pwhash_argon2id_opslimit_sensitive(void);
85 |
86 | #define crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 1073741824U
87 | SODIUM_EXPORT
88 | size_t crypto_pwhash_argon2id_memlimit_sensitive(void);
89 |
90 | SODIUM_EXPORT
91 | int crypto_pwhash_argon2id(unsigned char * const out,
92 | unsigned long long outlen,
93 | const char * const passwd,
94 | unsigned long long passwdlen,
95 | const unsigned char * const salt,
96 | unsigned long long opslimit, size_t memlimit,
97 | int alg)
98 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
99 |
100 | SODIUM_EXPORT
101 | int crypto_pwhash_argon2id_str(char out[crypto_pwhash_argon2id_STRBYTES],
102 | const char * const passwd,
103 | unsigned long long passwdlen,
104 | unsigned long long opslimit, size_t memlimit)
105 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
106 |
107 | SODIUM_EXPORT
108 | int crypto_pwhash_argon2id_str_verify(const char * str,
109 | const char * const passwd,
110 | unsigned long long passwdlen)
111 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
112 |
113 | SODIUM_EXPORT
114 | int crypto_pwhash_argon2id_str_needs_rehash(const char * str,
115 | unsigned long long opslimit, size_t memlimit)
116 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
117 |
118 | #ifdef __cplusplus
119 | }
120 | #endif
121 |
122 | #endif
123 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_pwhash_scryptsalsa208sha256.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_pwhash_scryptsalsa208sha256_H
2 | #define crypto_pwhash_scryptsalsa208sha256_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "export.h"
9 |
10 | #ifdef __cplusplus
11 | # ifdef __GNUC__
12 | # pragma GCC diagnostic ignored "-Wlong-long"
13 | # endif
14 | extern "C" {
15 | #endif
16 |
17 | #define crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16U
18 | SODIUM_EXPORT
19 | size_t crypto_pwhash_scryptsalsa208sha256_bytes_min(void);
20 |
21 | #define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX \
22 | SODIUM_MIN(SODIUM_SIZE_MAX, 0x1fffffffe0ULL)
23 | SODIUM_EXPORT
24 | size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void);
25 |
26 | #define crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 0U
27 | SODIUM_EXPORT
28 | size_t crypto_pwhash_scryptsalsa208sha256_passwd_min(void);
29 |
30 | #define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SODIUM_SIZE_MAX
31 | SODIUM_EXPORT
32 | size_t crypto_pwhash_scryptsalsa208sha256_passwd_max(void);
33 |
34 | #define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U
35 | SODIUM_EXPORT
36 | size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void);
37 |
38 | #define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U
39 | SODIUM_EXPORT
40 | size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void);
41 |
42 | #define crypto_pwhash_scryptsalsa208sha256_STRPREFIX "$7$"
43 | SODIUM_EXPORT
44 | const char *crypto_pwhash_scryptsalsa208sha256_strprefix(void);
45 |
46 | #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768U
47 | SODIUM_EXPORT
48 | size_t crypto_pwhash_scryptsalsa208sha256_opslimit_min(void);
49 |
50 | #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 4294967295U
51 | SODIUM_EXPORT
52 | size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max(void);
53 |
54 | #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 16777216U
55 | SODIUM_EXPORT
56 | size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min(void);
57 |
58 | #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX \
59 | SODIUM_MIN(SIZE_MAX, 68719476736ULL)
60 | SODIUM_EXPORT
61 | size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max(void);
62 |
63 | #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288U
64 | SODIUM_EXPORT
65 | size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void);
66 |
67 | #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216U
68 | SODIUM_EXPORT
69 | size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void);
70 |
71 | #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432U
72 | SODIUM_EXPORT
73 | size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void);
74 |
75 | #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824U
76 | SODIUM_EXPORT
77 | size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void);
78 |
79 | SODIUM_EXPORT
80 | int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
81 | unsigned long long outlen,
82 | const char * const passwd,
83 | unsigned long long passwdlen,
84 | const unsigned char * const salt,
85 | unsigned long long opslimit,
86 | size_t memlimit)
87 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
88 |
89 | SODIUM_EXPORT
90 | int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
91 | const char * const passwd,
92 | unsigned long long passwdlen,
93 | unsigned long long opslimit,
94 | size_t memlimit)
95 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
96 |
97 | SODIUM_EXPORT
98 | int crypto_pwhash_scryptsalsa208sha256_str_verify(const char * str,
99 | const char * const passwd,
100 | unsigned long long passwdlen)
101 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
102 |
103 | SODIUM_EXPORT
104 | int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
105 | const uint8_t * salt, size_t saltlen,
106 | uint64_t N, uint32_t r, uint32_t p,
107 | uint8_t * buf, size_t buflen)
108 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
109 |
110 | SODIUM_EXPORT
111 | int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(const char * str,
112 | unsigned long long opslimit,
113 | size_t memlimit)
114 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
115 |
116 | #ifdef __cplusplus
117 | }
118 | #endif
119 |
120 | #endif
121 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_scalarmult.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_scalarmult_H
2 | #define crypto_scalarmult_H
3 |
4 | #include
5 |
6 | #include "crypto_scalarmult_curve25519.h"
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | #define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES
14 | SODIUM_EXPORT
15 | size_t crypto_scalarmult_bytes(void);
16 |
17 | #define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES
18 | SODIUM_EXPORT
19 | size_t crypto_scalarmult_scalarbytes(void);
20 |
21 | #define crypto_scalarmult_PRIMITIVE "curve25519"
22 | SODIUM_EXPORT
23 | const char *crypto_scalarmult_primitive(void);
24 |
25 | SODIUM_EXPORT
26 | int crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
27 | __attribute__ ((nonnull));
28 |
29 | /*
30 | * NOTE: Do not use the result of this function directly for key exchange.
31 | *
32 | * Hash the result with the public keys in order to compute a shared
33 | * secret key: H(q || client_pk || server_pk)
34 | *
35 | * Or unless this is not an option, use the crypto_kx() API instead.
36 | */
37 | SODIUM_EXPORT
38 | int crypto_scalarmult(unsigned char *q, const unsigned char *n,
39 | const unsigned char *p)
40 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_scalarmult_curve25519.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_scalarmult_curve25519_H
2 | #define crypto_scalarmult_curve25519_H
3 |
4 | #include
5 |
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | #define crypto_scalarmult_curve25519_BYTES 32U
13 | SODIUM_EXPORT
14 | size_t crypto_scalarmult_curve25519_bytes(void);
15 |
16 | #define crypto_scalarmult_curve25519_SCALARBYTES 32U
17 | SODIUM_EXPORT
18 | size_t crypto_scalarmult_curve25519_scalarbytes(void);
19 |
20 | /*
21 | * NOTE: Do not use the result of this function directly for key exchange.
22 | *
23 | * Hash the result with the public keys in order to compute a shared
24 | * secret key: H(q || client_pk || server_pk)
25 | *
26 | * Or unless this is not an option, use the crypto_kx() API instead.
27 | */
28 | SODIUM_EXPORT
29 | int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
30 | const unsigned char *p)
31 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
32 |
33 | SODIUM_EXPORT
34 | int crypto_scalarmult_curve25519_base(unsigned char *q,
35 | const unsigned char *n)
36 | __attribute__ ((nonnull));
37 |
38 | #ifdef __cplusplus
39 | }
40 | #endif
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_scalarmult_ed25519.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef crypto_scalarmult_ed25519_H
3 | #define crypto_scalarmult_ed25519_H
4 |
5 | #include
6 |
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | #define crypto_scalarmult_ed25519_BYTES 32U
14 | SODIUM_EXPORT
15 | size_t crypto_scalarmult_ed25519_bytes(void);
16 |
17 | #define crypto_scalarmult_ed25519_SCALARBYTES 32U
18 | SODIUM_EXPORT
19 | size_t crypto_scalarmult_ed25519_scalarbytes(void);
20 |
21 | /*
22 | * NOTE: Do not use the result of this function directly for key exchange.
23 | *
24 | * Hash the result with the public keys in order to compute a shared
25 | * secret key: H(q || client_pk || server_pk)
26 | *
27 | * Or unless this is not an option, use the crypto_kx() API instead.
28 | */
29 | SODIUM_EXPORT
30 | int crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
31 | const unsigned char *p)
32 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
33 |
34 | SODIUM_EXPORT
35 | int crypto_scalarmult_ed25519_noclamp(unsigned char *q, const unsigned char *n,
36 | const unsigned char *p)
37 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
38 |
39 | SODIUM_EXPORT
40 | int crypto_scalarmult_ed25519_base(unsigned char *q, const unsigned char *n)
41 | __attribute__ ((nonnull));
42 |
43 | SODIUM_EXPORT
44 | int crypto_scalarmult_ed25519_base_noclamp(unsigned char *q, const unsigned char *n)
45 | __attribute__ ((nonnull));
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_scalarmult_ristretto255.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef crypto_scalarmult_ristretto255_H
3 | #define crypto_scalarmult_ristretto255_H
4 |
5 | #include
6 |
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | #define crypto_scalarmult_ristretto255_BYTES 32U
14 | SODIUM_EXPORT
15 | size_t crypto_scalarmult_ristretto255_bytes(void);
16 |
17 | #define crypto_scalarmult_ristretto255_SCALARBYTES 32U
18 | SODIUM_EXPORT
19 | size_t crypto_scalarmult_ristretto255_scalarbytes(void);
20 |
21 | /*
22 | * NOTE: Do not use the result of this function directly for key exchange.
23 | *
24 | * Hash the result with the public keys in order to compute a shared
25 | * secret key: H(q || client_pk || server_pk)
26 | *
27 | * Or unless this is not an option, use the crypto_kx() API instead.
28 | */
29 | SODIUM_EXPORT
30 | int crypto_scalarmult_ristretto255(unsigned char *q, const unsigned char *n,
31 | const unsigned char *p)
32 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
33 |
34 | SODIUM_EXPORT
35 | int crypto_scalarmult_ristretto255_base(unsigned char *q,
36 | const unsigned char *n)
37 | __attribute__ ((nonnull));
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_secretbox.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_secretbox_H
2 | #define crypto_secretbox_H
3 |
4 | #include
5 |
6 | #include "crypto_secretbox_xsalsa20poly1305.h"
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | # ifdef __GNUC__
11 | # pragma GCC diagnostic ignored "-Wlong-long"
12 | # endif
13 | extern "C" {
14 | #endif
15 |
16 | #define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES
17 | SODIUM_EXPORT
18 | size_t crypto_secretbox_keybytes(void);
19 |
20 | #define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
21 | SODIUM_EXPORT
22 | size_t crypto_secretbox_noncebytes(void);
23 |
24 | #define crypto_secretbox_MACBYTES crypto_secretbox_xsalsa20poly1305_MACBYTES
25 | SODIUM_EXPORT
26 | size_t crypto_secretbox_macbytes(void);
27 |
28 | #define crypto_secretbox_PRIMITIVE "xsalsa20poly1305"
29 | SODIUM_EXPORT
30 | const char *crypto_secretbox_primitive(void);
31 |
32 | #define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
33 | SODIUM_EXPORT
34 | size_t crypto_secretbox_messagebytes_max(void);
35 |
36 | SODIUM_EXPORT
37 | int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
38 | unsigned long long mlen, const unsigned char *n,
39 | const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
40 |
41 | SODIUM_EXPORT
42 | int crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
43 | unsigned long long clen, const unsigned char *n,
44 | const unsigned char *k)
45 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
46 |
47 | SODIUM_EXPORT
48 | int crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
49 | const unsigned char *m,
50 | unsigned long long mlen,
51 | const unsigned char *n,
52 | const unsigned char *k)
53 | __attribute__ ((nonnull(1, 2, 5, 6)));
54 |
55 | SODIUM_EXPORT
56 | int crypto_secretbox_open_detached(unsigned char *m,
57 | const unsigned char *c,
58 | const unsigned char *mac,
59 | unsigned long long clen,
60 | const unsigned char *n,
61 | const unsigned char *k)
62 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
63 |
64 | SODIUM_EXPORT
65 | void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES])
66 | __attribute__ ((nonnull));
67 |
68 | /* -- NaCl compatibility interface ; Requires padding -- */
69 |
70 | #define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
71 | SODIUM_EXPORT
72 | size_t crypto_secretbox_zerobytes(void);
73 |
74 | #define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
75 | SODIUM_EXPORT
76 | size_t crypto_secretbox_boxzerobytes(void);
77 |
78 | SODIUM_EXPORT
79 | int crypto_secretbox(unsigned char *c, const unsigned char *m,
80 | unsigned long long mlen, const unsigned char *n,
81 | const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
82 |
83 | SODIUM_EXPORT
84 | int crypto_secretbox_open(unsigned char *m, const unsigned char *c,
85 | unsigned long long clen, const unsigned char *n,
86 | const unsigned char *k)
87 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
88 |
89 | #ifdef __cplusplus
90 | }
91 | #endif
92 |
93 | #endif
94 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_secretbox_xchacha20poly1305.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_secretbox_xchacha20poly1305_H
2 | #define crypto_secretbox_xchacha20poly1305_H
3 |
4 | #include
5 | #include "crypto_stream_xchacha20.h"
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_secretbox_xchacha20poly1305_KEYBYTES 32U
16 | SODIUM_EXPORT
17 | size_t crypto_secretbox_xchacha20poly1305_keybytes(void);
18 |
19 | #define crypto_secretbox_xchacha20poly1305_NONCEBYTES 24U
20 | SODIUM_EXPORT
21 | size_t crypto_secretbox_xchacha20poly1305_noncebytes(void);
22 |
23 | #define crypto_secretbox_xchacha20poly1305_MACBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_secretbox_xchacha20poly1305_macbytes(void);
26 |
27 | #define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \
28 | (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
29 | SODIUM_EXPORT
30 | size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void);
31 |
32 | SODIUM_EXPORT
33 | int crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
34 | const unsigned char *m,
35 | unsigned long long mlen,
36 | const unsigned char *n,
37 | const unsigned char *k)
38 | __attribute__ ((nonnull(1, 4, 5)));
39 |
40 | SODIUM_EXPORT
41 | int crypto_secretbox_xchacha20poly1305_open_easy(unsigned char *m,
42 | const unsigned char *c,
43 | unsigned long long clen,
44 | const unsigned char *n,
45 | const unsigned char *k)
46 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
47 |
48 | SODIUM_EXPORT
49 | int crypto_secretbox_xchacha20poly1305_detached(unsigned char *c,
50 | unsigned char *mac,
51 | const unsigned char *m,
52 | unsigned long long mlen,
53 | const unsigned char *n,
54 | const unsigned char *k)
55 | __attribute__ ((nonnull(1, 2, 5, 6)));
56 |
57 | SODIUM_EXPORT
58 | int crypto_secretbox_xchacha20poly1305_open_detached(unsigned char *m,
59 | const unsigned char *c,
60 | const unsigned char *mac,
61 | unsigned long long clen,
62 | const unsigned char *n,
63 | const unsigned char *k)
64 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
65 |
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_secretbox_xsalsa20poly1305.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_secretbox_xsalsa20poly1305_H
2 | #define crypto_secretbox_xsalsa20poly1305_H
3 |
4 | #include
5 | #include "crypto_stream_xsalsa20.h"
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | #define crypto_secretbox_xsalsa20poly1305_KEYBYTES 32U
16 | SODIUM_EXPORT
17 | size_t crypto_secretbox_xsalsa20poly1305_keybytes(void);
18 |
19 | #define crypto_secretbox_xsalsa20poly1305_NONCEBYTES 24U
20 | SODIUM_EXPORT
21 | size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void);
22 |
23 | #define crypto_secretbox_xsalsa20poly1305_MACBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
26 |
27 | /* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
28 | #define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \
29 | (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES)
30 | SODIUM_EXPORT
31 | size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void);
32 |
33 | SODIUM_EXPORT
34 | int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
35 | const unsigned char *m,
36 | unsigned long long mlen,
37 | const unsigned char *n,
38 | const unsigned char *k)
39 | __attribute__ ((nonnull(1, 4, 5)));
40 |
41 | SODIUM_EXPORT
42 | int crypto_secretbox_xsalsa20poly1305_open(unsigned char *m,
43 | const unsigned char *c,
44 | unsigned long long clen,
45 | const unsigned char *n,
46 | const unsigned char *k)
47 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
48 |
49 | SODIUM_EXPORT
50 | void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES])
51 | __attribute__ ((nonnull));
52 |
53 | /* -- NaCl compatibility interface ; Requires padding -- */
54 |
55 | #define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U
56 | SODIUM_EXPORT
57 | size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void);
58 |
59 | #define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \
60 | (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \
61 | crypto_secretbox_xsalsa20poly1305_MACBYTES)
62 | SODIUM_EXPORT
63 | size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void);
64 |
65 | #ifdef __cplusplus
66 | }
67 | #endif
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_secretstream_xchacha20poly1305.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_secretstream_xchacha20poly1305_H
2 | #define crypto_secretstream_xchacha20poly1305_H
3 |
4 | #include
5 |
6 | #include "crypto_aead_xchacha20poly1305.h"
7 | #include "crypto_stream_chacha20.h"
8 | #include "export.h"
9 |
10 | #ifdef __cplusplus
11 | # ifdef __GNUC__
12 | # pragma GCC diagnostic ignored "-Wlong-long"
13 | # endif
14 | extern "C" {
15 | #endif
16 |
17 | #define crypto_secretstream_xchacha20poly1305_ABYTES \
18 | (1U + crypto_aead_xchacha20poly1305_ietf_ABYTES)
19 | SODIUM_EXPORT
20 | size_t crypto_secretstream_xchacha20poly1305_abytes(void);
21 |
22 | #define crypto_secretstream_xchacha20poly1305_HEADERBYTES \
23 | crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
24 | SODIUM_EXPORT
25 | size_t crypto_secretstream_xchacha20poly1305_headerbytes(void);
26 |
27 | #define crypto_secretstream_xchacha20poly1305_KEYBYTES \
28 | crypto_aead_xchacha20poly1305_ietf_KEYBYTES
29 | SODIUM_EXPORT
30 | size_t crypto_secretstream_xchacha20poly1305_keybytes(void);
31 |
32 | #define crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX \
33 | SODIUM_MIN(SODIUM_SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES, \
34 | (64ULL * ((1ULL << 32) - 2ULL)))
35 | SODIUM_EXPORT
36 | size_t crypto_secretstream_xchacha20poly1305_messagebytes_max(void);
37 |
38 | #define crypto_secretstream_xchacha20poly1305_TAG_MESSAGE 0x00
39 | SODIUM_EXPORT
40 | unsigned char crypto_secretstream_xchacha20poly1305_tag_message(void);
41 |
42 | #define crypto_secretstream_xchacha20poly1305_TAG_PUSH 0x01
43 | SODIUM_EXPORT
44 | unsigned char crypto_secretstream_xchacha20poly1305_tag_push(void);
45 |
46 | #define crypto_secretstream_xchacha20poly1305_TAG_REKEY 0x02
47 | SODIUM_EXPORT
48 | unsigned char crypto_secretstream_xchacha20poly1305_tag_rekey(void);
49 |
50 | #define crypto_secretstream_xchacha20poly1305_TAG_FINAL \
51 | (crypto_secretstream_xchacha20poly1305_TAG_PUSH | \
52 | crypto_secretstream_xchacha20poly1305_TAG_REKEY)
53 | SODIUM_EXPORT
54 | unsigned char crypto_secretstream_xchacha20poly1305_tag_final(void);
55 |
56 | typedef struct crypto_secretstream_xchacha20poly1305_state {
57 | unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES];
58 | unsigned char nonce[crypto_stream_chacha20_ietf_NONCEBYTES];
59 | unsigned char _pad[8];
60 | } crypto_secretstream_xchacha20poly1305_state;
61 |
62 | SODIUM_EXPORT
63 | size_t crypto_secretstream_xchacha20poly1305_statebytes(void);
64 |
65 | SODIUM_EXPORT
66 | void crypto_secretstream_xchacha20poly1305_keygen
67 | (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
68 | __attribute__ ((nonnull));
69 |
70 | SODIUM_EXPORT
71 | int crypto_secretstream_xchacha20poly1305_init_push
72 | (crypto_secretstream_xchacha20poly1305_state *state,
73 | unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
74 | const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
75 | __attribute__ ((nonnull));
76 |
77 | SODIUM_EXPORT
78 | int crypto_secretstream_xchacha20poly1305_push
79 | (crypto_secretstream_xchacha20poly1305_state *state,
80 | unsigned char *c, unsigned long long *clen_p,
81 | const unsigned char *m, unsigned long long mlen,
82 | const unsigned char *ad, unsigned long long adlen, unsigned char tag)
83 | __attribute__ ((nonnull(1)));
84 |
85 | SODIUM_EXPORT
86 | int crypto_secretstream_xchacha20poly1305_init_pull
87 | (crypto_secretstream_xchacha20poly1305_state *state,
88 | const unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
89 | const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
90 | __attribute__ ((nonnull));
91 |
92 | SODIUM_EXPORT
93 | int crypto_secretstream_xchacha20poly1305_pull
94 | (crypto_secretstream_xchacha20poly1305_state *state,
95 | unsigned char *m, unsigned long long *mlen_p, unsigned char *tag_p,
96 | const unsigned char *c, unsigned long long clen,
97 | const unsigned char *ad, unsigned long long adlen)
98 | __attribute__ ((nonnull(1)));
99 |
100 | SODIUM_EXPORT
101 | void crypto_secretstream_xchacha20poly1305_rekey
102 | (crypto_secretstream_xchacha20poly1305_state *state);
103 |
104 | #ifdef __cplusplus
105 | }
106 | #endif
107 |
108 | #endif
109 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_shorthash.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_shorthash_H
2 | #define crypto_shorthash_H
3 |
4 | #include
5 |
6 | #include "crypto_shorthash_siphash24.h"
7 | #include "export.h"
8 |
9 | #ifdef __cplusplus
10 | # ifdef __GNUC__
11 | # pragma GCC diagnostic ignored "-Wlong-long"
12 | # endif
13 | extern "C" {
14 | #endif
15 |
16 | #define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES
17 | SODIUM_EXPORT
18 | size_t crypto_shorthash_bytes(void);
19 |
20 | #define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES
21 | SODIUM_EXPORT
22 | size_t crypto_shorthash_keybytes(void);
23 |
24 | #define crypto_shorthash_PRIMITIVE "siphash24"
25 | SODIUM_EXPORT
26 | const char *crypto_shorthash_primitive(void);
27 |
28 | SODIUM_EXPORT
29 | int crypto_shorthash(unsigned char *out, const unsigned char *in,
30 | unsigned long long inlen, const unsigned char *k)
31 | __attribute__ ((nonnull(1, 4)));
32 |
33 | SODIUM_EXPORT
34 | void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES])
35 | __attribute__ ((nonnull));
36 |
37 | #ifdef __cplusplus
38 | }
39 | #endif
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_shorthash_siphash24.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_shorthash_siphash24_H
2 | #define crypto_shorthash_siphash24_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | # ifdef __GNUC__
9 | # pragma GCC diagnostic ignored "-Wlong-long"
10 | # endif
11 | extern "C" {
12 | #endif
13 |
14 | /* -- 64-bit output -- */
15 |
16 | #define crypto_shorthash_siphash24_BYTES 8U
17 | SODIUM_EXPORT
18 | size_t crypto_shorthash_siphash24_bytes(void);
19 |
20 | #define crypto_shorthash_siphash24_KEYBYTES 16U
21 | SODIUM_EXPORT
22 | size_t crypto_shorthash_siphash24_keybytes(void);
23 |
24 | SODIUM_EXPORT
25 | int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in,
26 | unsigned long long inlen, const unsigned char *k)
27 | __attribute__ ((nonnull(1, 4)));
28 |
29 | #ifndef SODIUM_LIBRARY_MINIMAL
30 | /* -- 128-bit output -- */
31 |
32 | #define crypto_shorthash_siphashx24_BYTES 16U
33 | SODIUM_EXPORT
34 | size_t crypto_shorthash_siphashx24_bytes(void);
35 |
36 | #define crypto_shorthash_siphashx24_KEYBYTES 16U
37 | SODIUM_EXPORT
38 | size_t crypto_shorthash_siphashx24_keybytes(void);
39 |
40 | SODIUM_EXPORT
41 | int crypto_shorthash_siphashx24(unsigned char *out, const unsigned char *in,
42 | unsigned long long inlen, const unsigned char *k)
43 | __attribute__ ((nonnull(1, 4)));
44 | #endif
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_sign.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_sign_H
2 | #define crypto_sign_H
3 |
4 | /*
5 | * THREAD SAFETY: crypto_sign_keypair() is thread-safe,
6 | * provided that sodium_init() was called before.
7 | *
8 | * Other functions, including crypto_sign_seed_keypair() are always thread-safe.
9 | */
10 |
11 | #include
12 |
13 | #include "crypto_sign_ed25519.h"
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | # ifdef __GNUC__
18 | # pragma GCC diagnostic ignored "-Wlong-long"
19 | # endif
20 | extern "C" {
21 | #endif
22 |
23 | typedef crypto_sign_ed25519ph_state crypto_sign_state;
24 |
25 | SODIUM_EXPORT
26 | size_t crypto_sign_statebytes(void);
27 |
28 | #define crypto_sign_BYTES crypto_sign_ed25519_BYTES
29 | SODIUM_EXPORT
30 | size_t crypto_sign_bytes(void);
31 |
32 | #define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
33 | SODIUM_EXPORT
34 | size_t crypto_sign_seedbytes(void);
35 |
36 | #define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
37 | SODIUM_EXPORT
38 | size_t crypto_sign_publickeybytes(void);
39 |
40 | #define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
41 | SODIUM_EXPORT
42 | size_t crypto_sign_secretkeybytes(void);
43 |
44 | #define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX
45 | SODIUM_EXPORT
46 | size_t crypto_sign_messagebytes_max(void);
47 |
48 | #define crypto_sign_PRIMITIVE "ed25519"
49 | SODIUM_EXPORT
50 | const char *crypto_sign_primitive(void);
51 |
52 | SODIUM_EXPORT
53 | int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
54 | const unsigned char *seed)
55 | __attribute__ ((nonnull));
56 |
57 | SODIUM_EXPORT
58 | int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
59 | __attribute__ ((nonnull));
60 |
61 | SODIUM_EXPORT
62 | int crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
63 | const unsigned char *m, unsigned long long mlen,
64 | const unsigned char *sk) __attribute__ ((nonnull(1, 5)));
65 |
66 | SODIUM_EXPORT
67 | int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
68 | const unsigned char *sm, unsigned long long smlen,
69 | const unsigned char *pk)
70 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
71 |
72 | SODIUM_EXPORT
73 | int crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
74 | const unsigned char *m, unsigned long long mlen,
75 | const unsigned char *sk) __attribute__ ((nonnull(1, 5)));
76 |
77 | SODIUM_EXPORT
78 | int crypto_sign_verify_detached(const unsigned char *sig,
79 | const unsigned char *m,
80 | unsigned long long mlen,
81 | const unsigned char *pk)
82 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
83 |
84 | SODIUM_EXPORT
85 | int crypto_sign_init(crypto_sign_state *state);
86 |
87 | SODIUM_EXPORT
88 | int crypto_sign_update(crypto_sign_state *state,
89 | const unsigned char *m, unsigned long long mlen)
90 | __attribute__ ((nonnull(1)));
91 |
92 | SODIUM_EXPORT
93 | int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig,
94 | unsigned long long *siglen_p,
95 | const unsigned char *sk)
96 | __attribute__ ((nonnull(1, 2, 4)));
97 |
98 | SODIUM_EXPORT
99 | int crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig,
100 | const unsigned char *pk)
101 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
102 |
103 | #ifdef __cplusplus
104 | }
105 | #endif
106 |
107 | #endif
108 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_sign_ed25519.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_sign_ed25519_H
2 | #define crypto_sign_ed25519_H
3 |
4 | #include
5 | #include "crypto_hash_sha512.h"
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | # ifdef __GNUC__
10 | # pragma GCC diagnostic ignored "-Wlong-long"
11 | # endif
12 | extern "C" {
13 | #endif
14 |
15 | typedef struct crypto_sign_ed25519ph_state {
16 | crypto_hash_sha512_state hs;
17 | } crypto_sign_ed25519ph_state;
18 |
19 | SODIUM_EXPORT
20 | size_t crypto_sign_ed25519ph_statebytes(void);
21 |
22 | #define crypto_sign_ed25519_BYTES 64U
23 | SODIUM_EXPORT
24 | size_t crypto_sign_ed25519_bytes(void);
25 |
26 | #define crypto_sign_ed25519_SEEDBYTES 32U
27 | SODIUM_EXPORT
28 | size_t crypto_sign_ed25519_seedbytes(void);
29 |
30 | #define crypto_sign_ed25519_PUBLICKEYBYTES 32U
31 | SODIUM_EXPORT
32 | size_t crypto_sign_ed25519_publickeybytes(void);
33 |
34 | #define crypto_sign_ed25519_SECRETKEYBYTES (32U + 32U)
35 | SODIUM_EXPORT
36 | size_t crypto_sign_ed25519_secretkeybytes(void);
37 |
38 | #define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)
39 | SODIUM_EXPORT
40 | size_t crypto_sign_ed25519_messagebytes_max(void);
41 |
42 | SODIUM_EXPORT
43 | int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
44 | const unsigned char *m, unsigned long long mlen,
45 | const unsigned char *sk)
46 | __attribute__ ((nonnull(1, 5)));
47 |
48 | SODIUM_EXPORT
49 | int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
50 | const unsigned char *sm, unsigned long long smlen,
51 | const unsigned char *pk)
52 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
53 |
54 | SODIUM_EXPORT
55 | int crypto_sign_ed25519_detached(unsigned char *sig,
56 | unsigned long long *siglen_p,
57 | const unsigned char *m,
58 | unsigned long long mlen,
59 | const unsigned char *sk)
60 | __attribute__ ((nonnull(1, 5)));
61 |
62 | SODIUM_EXPORT
63 | int crypto_sign_ed25519_verify_detached(const unsigned char *sig,
64 | const unsigned char *m,
65 | unsigned long long mlen,
66 | const unsigned char *pk)
67 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
68 |
69 | SODIUM_EXPORT
70 | int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk)
71 | __attribute__ ((nonnull));
72 |
73 | SODIUM_EXPORT
74 | int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
75 | const unsigned char *seed)
76 | __attribute__ ((nonnull));
77 |
78 | SODIUM_EXPORT
79 | int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
80 | const unsigned char *ed25519_pk)
81 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
82 |
83 | SODIUM_EXPORT
84 | int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
85 | const unsigned char *ed25519_sk)
86 | __attribute__ ((nonnull));
87 |
88 | SODIUM_EXPORT
89 | int crypto_sign_ed25519_sk_to_seed(unsigned char *seed,
90 | const unsigned char *sk)
91 | __attribute__ ((nonnull));
92 |
93 | SODIUM_EXPORT
94 | int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
95 | __attribute__ ((nonnull));
96 |
97 | SODIUM_EXPORT
98 | int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state)
99 | __attribute__ ((nonnull));
100 |
101 | SODIUM_EXPORT
102 | int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state,
103 | const unsigned char *m,
104 | unsigned long long mlen)
105 | __attribute__ ((nonnull(1)));
106 |
107 | SODIUM_EXPORT
108 | int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state,
109 | unsigned char *sig,
110 | unsigned long long *siglen_p,
111 | const unsigned char *sk)
112 | __attribute__ ((nonnull(1, 2, 4)));
113 |
114 | SODIUM_EXPORT
115 | int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state,
116 | const unsigned char *sig,
117 | const unsigned char *pk)
118 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
119 |
120 | #ifdef __cplusplus
121 | }
122 | #endif
123 |
124 | #endif
125 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_sign_edwards25519sha512batch.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_sign_edwards25519sha512batch_H
2 | #define crypto_sign_edwards25519sha512batch_H
3 |
4 | /*
5 | * WARNING: This construction was a prototype, which should not be used
6 | * any more in new projects.
7 | *
8 | * crypto_sign_edwards25519sha512batch is provided for applications
9 | * initially built with NaCl, but as recommended by the author of this
10 | * construction, new applications should use ed25519 instead.
11 | *
12 | * In Sodium, you should use the high-level crypto_sign_*() functions instead.
13 | */
14 |
15 | #include
16 | #include "export.h"
17 |
18 | #ifdef __cplusplus
19 | # ifdef __GNUC__
20 | # pragma GCC diagnostic ignored "-Wlong-long"
21 | # endif
22 | extern "C" {
23 | #endif
24 |
25 | #define crypto_sign_edwards25519sha512batch_BYTES 64U
26 | #define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U
27 | #define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U)
28 | #define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES)
29 |
30 | SODIUM_EXPORT
31 | int crypto_sign_edwards25519sha512batch(unsigned char *sm,
32 | unsigned long long *smlen_p,
33 | const unsigned char *m,
34 | unsigned long long mlen,
35 | const unsigned char *sk)
36 | __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 5)));
37 |
38 | SODIUM_EXPORT
39 | int crypto_sign_edwards25519sha512batch_open(unsigned char *m,
40 | unsigned long long *mlen_p,
41 | const unsigned char *sm,
42 | unsigned long long smlen,
43 | const unsigned char *pk)
44 | __attribute__ ((deprecated)) __attribute__ ((nonnull(3, 5)));
45 |
46 | SODIUM_EXPORT
47 | int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk,
48 | unsigned char *sk)
49 | __attribute__ ((deprecated)) __attribute__ ((nonnull));
50 |
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_stream.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_stream_H
2 | #define crypto_stream_H
3 |
4 | /*
5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6 | * While it provides some protection against eavesdropping, it does NOT
7 | * provide any security against active attacks.
8 | * Unless you know what you're doing, what you are looking for is probably
9 | * the crypto_box functions.
10 | */
11 |
12 | #include
13 |
14 | #include "crypto_stream_xsalsa20.h"
15 | #include "export.h"
16 |
17 | #ifdef __cplusplus
18 | # ifdef __GNUC__
19 | # pragma GCC diagnostic ignored "-Wlong-long"
20 | # endif
21 | extern "C" {
22 | #endif
23 |
24 | #define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
25 | SODIUM_EXPORT
26 | size_t crypto_stream_keybytes(void);
27 |
28 | #define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
29 | SODIUM_EXPORT
30 | size_t crypto_stream_noncebytes(void);
31 |
32 | #define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX
33 | SODIUM_EXPORT
34 | size_t crypto_stream_messagebytes_max(void);
35 |
36 | #define crypto_stream_PRIMITIVE "xsalsa20"
37 | SODIUM_EXPORT
38 | const char *crypto_stream_primitive(void);
39 |
40 | SODIUM_EXPORT
41 | int crypto_stream(unsigned char *c, unsigned long long clen,
42 | const unsigned char *n, const unsigned char *k)
43 | __attribute__ ((nonnull));
44 |
45 | SODIUM_EXPORT
46 | int crypto_stream_xor(unsigned char *c, const unsigned char *m,
47 | unsigned long long mlen, const unsigned char *n,
48 | const unsigned char *k)
49 | __attribute__ ((nonnull));
50 |
51 | SODIUM_EXPORT
52 | void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES])
53 | __attribute__ ((nonnull));
54 |
55 | #ifdef __cplusplus
56 | }
57 | #endif
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_stream_chacha20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_stream_chacha20_H
2 | #define crypto_stream_chacha20_H
3 |
4 | /*
5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6 | * While it provides some protection against eavesdropping, it does NOT
7 | * provide any security against active attacks.
8 | * Unless you know what you're doing, what you are looking for is probably
9 | * the crypto_box functions.
10 | */
11 |
12 | #include
13 | #include
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | # ifdef __GNUC__
18 | # pragma GCC diagnostic ignored "-Wlong-long"
19 | # endif
20 | extern "C" {
21 | #endif
22 |
23 | #define crypto_stream_chacha20_KEYBYTES 32U
24 | SODIUM_EXPORT
25 | size_t crypto_stream_chacha20_keybytes(void);
26 |
27 | #define crypto_stream_chacha20_NONCEBYTES 8U
28 | SODIUM_EXPORT
29 | size_t crypto_stream_chacha20_noncebytes(void);
30 |
31 | #define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
32 | SODIUM_EXPORT
33 | size_t crypto_stream_chacha20_messagebytes_max(void);
34 |
35 | /* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */
36 |
37 | SODIUM_EXPORT
38 | int crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
39 | const unsigned char *n, const unsigned char *k)
40 | __attribute__ ((nonnull));
41 |
42 | SODIUM_EXPORT
43 | int crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
44 | unsigned long long mlen, const unsigned char *n,
45 | const unsigned char *k)
46 | __attribute__ ((nonnull));
47 |
48 | SODIUM_EXPORT
49 | int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
50 | unsigned long long mlen,
51 | const unsigned char *n, uint64_t ic,
52 | const unsigned char *k)
53 | __attribute__ ((nonnull));
54 |
55 | SODIUM_EXPORT
56 | void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES])
57 | __attribute__ ((nonnull));
58 |
59 | /* ChaCha20 with a 96-bit nonce and a 32-bit counter (IETF) */
60 |
61 | #define crypto_stream_chacha20_ietf_KEYBYTES 32U
62 | SODIUM_EXPORT
63 | size_t crypto_stream_chacha20_ietf_keybytes(void);
64 |
65 | #define crypto_stream_chacha20_ietf_NONCEBYTES 12U
66 | SODIUM_EXPORT
67 | size_t crypto_stream_chacha20_ietf_noncebytes(void);
68 |
69 | #define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \
70 | SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32))
71 | SODIUM_EXPORT
72 | size_t crypto_stream_chacha20_ietf_messagebytes_max(void);
73 |
74 | SODIUM_EXPORT
75 | int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
76 | const unsigned char *n, const unsigned char *k)
77 | __attribute__ ((nonnull));
78 |
79 | SODIUM_EXPORT
80 | int crypto_stream_chacha20_ietf_xor(unsigned char *c, const unsigned char *m,
81 | unsigned long long mlen, const unsigned char *n,
82 | const unsigned char *k)
83 | __attribute__ ((nonnull));
84 |
85 | SODIUM_EXPORT
86 | int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
87 | unsigned long long mlen,
88 | const unsigned char *n, uint32_t ic,
89 | const unsigned char *k)
90 | __attribute__ ((nonnull));
91 |
92 | SODIUM_EXPORT
93 | void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES])
94 | __attribute__ ((nonnull));
95 |
96 | /* Aliases */
97 |
98 | #define crypto_stream_chacha20_IETF_KEYBYTES crypto_stream_chacha20_ietf_KEYBYTES
99 | #define crypto_stream_chacha20_IETF_NONCEBYTES crypto_stream_chacha20_ietf_NONCEBYTES
100 | #define crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX
101 |
102 | #ifdef __cplusplus
103 | }
104 | #endif
105 |
106 | #endif
107 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_stream_salsa20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_stream_salsa20_H
2 | #define crypto_stream_salsa20_H
3 |
4 | /*
5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6 | * While it provides some protection against eavesdropping, it does NOT
7 | * provide any security against active attacks.
8 | * Unless you know what you're doing, what you are looking for is probably
9 | * the crypto_box functions.
10 | */
11 |
12 | #include
13 | #include
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | # ifdef __GNUC__
18 | # pragma GCC diagnostic ignored "-Wlong-long"
19 | # endif
20 | extern "C" {
21 | #endif
22 |
23 | #define crypto_stream_salsa20_KEYBYTES 32U
24 | SODIUM_EXPORT
25 | size_t crypto_stream_salsa20_keybytes(void);
26 |
27 | #define crypto_stream_salsa20_NONCEBYTES 8U
28 | SODIUM_EXPORT
29 | size_t crypto_stream_salsa20_noncebytes(void);
30 |
31 | #define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
32 | SODIUM_EXPORT
33 | size_t crypto_stream_salsa20_messagebytes_max(void);
34 |
35 | SODIUM_EXPORT
36 | int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
37 | const unsigned char *n, const unsigned char *k)
38 | __attribute__ ((nonnull));
39 |
40 | SODIUM_EXPORT
41 | int crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
42 | unsigned long long mlen, const unsigned char *n,
43 | const unsigned char *k)
44 | __attribute__ ((nonnull));
45 |
46 | SODIUM_EXPORT
47 | int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m,
48 | unsigned long long mlen,
49 | const unsigned char *n, uint64_t ic,
50 | const unsigned char *k)
51 | __attribute__ ((nonnull));
52 |
53 | SODIUM_EXPORT
54 | void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES])
55 | __attribute__ ((nonnull));
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_stream_salsa2012.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_stream_salsa2012_H
2 | #define crypto_stream_salsa2012_H
3 |
4 | /*
5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6 | * While it provides some protection against eavesdropping, it does NOT
7 | * provide any security against active attacks.
8 | * Unless you know what you're doing, what you are looking for is probably
9 | * the crypto_box functions.
10 | */
11 |
12 | #include
13 | #include "export.h"
14 |
15 | #ifdef __cplusplus
16 | # ifdef __GNUC__
17 | # pragma GCC diagnostic ignored "-Wlong-long"
18 | # endif
19 | extern "C" {
20 | #endif
21 |
22 | #define crypto_stream_salsa2012_KEYBYTES 32U
23 | SODIUM_EXPORT
24 | size_t crypto_stream_salsa2012_keybytes(void);
25 |
26 | #define crypto_stream_salsa2012_NONCEBYTES 8U
27 | SODIUM_EXPORT
28 | size_t crypto_stream_salsa2012_noncebytes(void);
29 |
30 | #define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
31 | SODIUM_EXPORT
32 | size_t crypto_stream_salsa2012_messagebytes_max(void);
33 |
34 | SODIUM_EXPORT
35 | int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
36 | const unsigned char *n, const unsigned char *k)
37 | __attribute__ ((nonnull));
38 |
39 | SODIUM_EXPORT
40 | int crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m,
41 | unsigned long long mlen, const unsigned char *n,
42 | const unsigned char *k)
43 | __attribute__ ((nonnull));
44 |
45 | SODIUM_EXPORT
46 | void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
47 | __attribute__ ((nonnull));
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_stream_salsa208.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_stream_salsa208_H
2 | #define crypto_stream_salsa208_H
3 |
4 | /*
5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6 | * While it provides some protection against eavesdropping, it does NOT
7 | * provide any security against active attacks.
8 | * Unless you know what you're doing, what you are looking for is probably
9 | * the crypto_box functions.
10 | */
11 |
12 | #include
13 | #include "export.h"
14 |
15 | #ifdef __cplusplus
16 | # ifdef __GNUC__
17 | # pragma GCC diagnostic ignored "-Wlong-long"
18 | # endif
19 | extern "C" {
20 | #endif
21 |
22 | #define crypto_stream_salsa208_KEYBYTES 32U
23 | SODIUM_EXPORT
24 | size_t crypto_stream_salsa208_keybytes(void)
25 | __attribute__ ((deprecated));
26 |
27 | #define crypto_stream_salsa208_NONCEBYTES 8U
28 | SODIUM_EXPORT
29 | size_t crypto_stream_salsa208_noncebytes(void)
30 | __attribute__ ((deprecated));
31 |
32 | #define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
33 | SODIUM_EXPORT
34 | size_t crypto_stream_salsa208_messagebytes_max(void)
35 | __attribute__ ((deprecated));
36 |
37 | SODIUM_EXPORT
38 | int crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
39 | const unsigned char *n, const unsigned char *k)
40 | __attribute__ ((deprecated)) __attribute__ ((nonnull));
41 |
42 | SODIUM_EXPORT
43 | int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m,
44 | unsigned long long mlen, const unsigned char *n,
45 | const unsigned char *k)
46 | __attribute__ ((deprecated)) __attribute__ ((nonnull));
47 |
48 | SODIUM_EXPORT
49 | void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES])
50 | __attribute__ ((deprecated)) __attribute__ ((nonnull));
51 |
52 | #ifdef __cplusplus
53 | }
54 | #endif
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_stream_xchacha20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_stream_xchacha20_H
2 | #define crypto_stream_xchacha20_H
3 |
4 | /*
5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6 | * While it provides some protection against eavesdropping, it does NOT
7 | * provide any security against active attacks.
8 | * Unless you know what you're doing, what you are looking for is probably
9 | * the crypto_box functions.
10 | */
11 |
12 | #include
13 | #include
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | # ifdef __GNUC__
18 | # pragma GCC diagnostic ignored "-Wlong-long"
19 | # endif
20 | extern "C" {
21 | #endif
22 |
23 | #define crypto_stream_xchacha20_KEYBYTES 32U
24 | SODIUM_EXPORT
25 | size_t crypto_stream_xchacha20_keybytes(void);
26 |
27 | #define crypto_stream_xchacha20_NONCEBYTES 24U
28 | SODIUM_EXPORT
29 | size_t crypto_stream_xchacha20_noncebytes(void);
30 |
31 | #define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
32 | SODIUM_EXPORT
33 | size_t crypto_stream_xchacha20_messagebytes_max(void);
34 |
35 | SODIUM_EXPORT
36 | int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
37 | const unsigned char *n, const unsigned char *k)
38 | __attribute__ ((nonnull));
39 |
40 | SODIUM_EXPORT
41 | int crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m,
42 | unsigned long long mlen, const unsigned char *n,
43 | const unsigned char *k)
44 | __attribute__ ((nonnull));
45 |
46 | SODIUM_EXPORT
47 | int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m,
48 | unsigned long long mlen,
49 | const unsigned char *n, uint64_t ic,
50 | const unsigned char *k)
51 | __attribute__ ((nonnull));
52 |
53 | SODIUM_EXPORT
54 | void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES])
55 | __attribute__ ((nonnull));
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_stream_xsalsa20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_stream_xsalsa20_H
2 | #define crypto_stream_xsalsa20_H
3 |
4 | /*
5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6 | * While it provides some protection against eavesdropping, it does NOT
7 | * provide any security against active attacks.
8 | * Unless you know what you're doing, what you are looking for is probably
9 | * the crypto_box functions.
10 | */
11 |
12 | #include
13 | #include
14 | #include "export.h"
15 |
16 | #ifdef __cplusplus
17 | # ifdef __GNUC__
18 | # pragma GCC diagnostic ignored "-Wlong-long"
19 | # endif
20 | extern "C" {
21 | #endif
22 |
23 | #define crypto_stream_xsalsa20_KEYBYTES 32U
24 | SODIUM_EXPORT
25 | size_t crypto_stream_xsalsa20_keybytes(void);
26 |
27 | #define crypto_stream_xsalsa20_NONCEBYTES 24U
28 | SODIUM_EXPORT
29 | size_t crypto_stream_xsalsa20_noncebytes(void);
30 |
31 | #define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
32 | SODIUM_EXPORT
33 | size_t crypto_stream_xsalsa20_messagebytes_max(void);
34 |
35 | SODIUM_EXPORT
36 | int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
37 | const unsigned char *n, const unsigned char *k)
38 | __attribute__ ((nonnull));
39 |
40 | SODIUM_EXPORT
41 | int crypto_stream_xsalsa20_xor(unsigned char *c, const unsigned char *m,
42 | unsigned long long mlen, const unsigned char *n,
43 | const unsigned char *k)
44 | __attribute__ ((nonnull));
45 |
46 | SODIUM_EXPORT
47 | int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m,
48 | unsigned long long mlen,
49 | const unsigned char *n, uint64_t ic,
50 | const unsigned char *k)
51 | __attribute__ ((nonnull));
52 |
53 | SODIUM_EXPORT
54 | void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES])
55 | __attribute__ ((nonnull));
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_verify_16.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_verify_16_H
2 | #define crypto_verify_16_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_verify_16_BYTES 16U
12 | SODIUM_EXPORT
13 | size_t crypto_verify_16_bytes(void);
14 |
15 | SODIUM_EXPORT
16 | int crypto_verify_16(const unsigned char *x, const unsigned char *y)
17 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_verify_32.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_verify_32_H
2 | #define crypto_verify_32_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_verify_32_BYTES 32U
12 | SODIUM_EXPORT
13 | size_t crypto_verify_32_bytes(void);
14 |
15 | SODIUM_EXPORT
16 | int crypto_verify_32(const unsigned char *x, const unsigned char *y)
17 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/libsodium/sodium/crypto_verify_64.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_verify_64_H
2 | #define crypto_verify_64_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_verify_64_BYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_verify_64_bytes(void);
14 |
15 | SODIUM_EXPORT
16 | int crypto_verify_64(const unsigned char *x, const unsigned char *y)
17 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/libsodium/sodium/export.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_export_H
3 | #define sodium_export_H
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | #if !defined(__clang__) && !defined(__GNUC__)
10 | # ifdef __attribute__
11 | # undef __attribute__
12 | # endif
13 | # define __attribute__(a)
14 | #endif
15 |
16 | #ifdef SODIUM_STATIC
17 | # define SODIUM_EXPORT
18 | # define SODIUM_EXPORT_WEAK
19 | #else
20 | # if defined(_MSC_VER)
21 | # ifdef SODIUM_DLL_EXPORT
22 | # define SODIUM_EXPORT __declspec(dllexport)
23 | # else
24 | # define SODIUM_EXPORT __declspec(dllimport)
25 | # endif
26 | # else
27 | # if defined(__SUNPRO_C)
28 | # ifndef __GNU_C__
29 | # define SODIUM_EXPORT __attribute__ (visibility(__global))
30 | # else
31 | # define SODIUM_EXPORT __attribute__ __global
32 | # endif
33 | # elif defined(_MSG_VER)
34 | # define SODIUM_EXPORT extern __declspec(dllexport)
35 | # else
36 | # define SODIUM_EXPORT __attribute__ ((visibility ("default")))
37 | # endif
38 | # endif
39 | # if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS)
40 | # define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak))
41 | # else
42 | # define SODIUM_EXPORT_WEAK SODIUM_EXPORT
43 | # endif
44 | #endif
45 |
46 | #ifndef CRYPTO_ALIGN
47 | # if defined(__INTEL_COMPILER) || defined(_MSC_VER)
48 | # define CRYPTO_ALIGN(x) __declspec(align(x))
49 | # else
50 | # define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
51 | # endif
52 | #endif
53 |
54 | #define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B))
55 | #define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/libsodium/sodium/randombytes.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef randombytes_H
3 | #define randombytes_H
4 |
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | #include "export.h"
11 |
12 | #ifdef __cplusplus
13 | # ifdef __GNUC__
14 | # pragma GCC diagnostic ignored "-Wlong-long"
15 | # endif
16 | extern "C" {
17 | #endif
18 |
19 | typedef struct randombytes_implementation {
20 | const char *(*implementation_name)(void); /* required */
21 | uint32_t (*random)(void); /* required */
22 | void (*stir)(void); /* optional */
23 | uint32_t (*uniform)(const uint32_t upper_bound); /* optional, a default implementation will be used if NULL */
24 | void (*buf)(void * const buf, const size_t size); /* required */
25 | int (*close)(void); /* optional */
26 | } randombytes_implementation;
27 |
28 | #define randombytes_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0xffffffffUL)
29 |
30 | #define randombytes_SEEDBYTES 32U
31 | SODIUM_EXPORT
32 | size_t randombytes_seedbytes(void);
33 |
34 | SODIUM_EXPORT
35 | void randombytes_buf(void * const buf, const size_t size)
36 | __attribute__ ((nonnull));
37 |
38 | SODIUM_EXPORT
39 | void randombytes_buf_deterministic(void * const buf, const size_t size,
40 | const unsigned char seed[randombytes_SEEDBYTES])
41 | __attribute__ ((nonnull));
42 |
43 | SODIUM_EXPORT
44 | uint32_t randombytes_random(void);
45 |
46 | SODIUM_EXPORT
47 | uint32_t randombytes_uniform(const uint32_t upper_bound);
48 |
49 | SODIUM_EXPORT
50 | void randombytes_stir(void);
51 |
52 | SODIUM_EXPORT
53 | int randombytes_close(void);
54 |
55 | SODIUM_EXPORT
56 | int randombytes_set_implementation(const randombytes_implementation *impl)
57 | __attribute__ ((nonnull));
58 |
59 | SODIUM_EXPORT
60 | const char *randombytes_implementation_name(void);
61 |
62 | /* -- NaCl compatibility interface -- */
63 |
64 | SODIUM_EXPORT
65 | void randombytes(unsigned char * const buf, const unsigned long long buf_len)
66 | __attribute__ ((nonnull));
67 |
68 | #ifdef __cplusplus
69 | }
70 | #endif
71 |
72 | #endif
73 |
--------------------------------------------------------------------------------
/libsodium/sodium/randombytes_internal_random.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef randombytes_internal_random_H
3 | #define randombytes_internal_random_H
4 |
5 | #include "export.h"
6 | #include "randombytes.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | SODIUM_EXPORT
13 | extern struct randombytes_implementation randombytes_internal_implementation;
14 |
15 | /* Backwards compatibility with libsodium < 1.0.18 */
16 | #define randombytes_salsa20_implementation randombytes_internal_implementation
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/libsodium/sodium/randombytes_sysrandom.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef randombytes_sysrandom_H
3 | #define randombytes_sysrandom_H
4 |
5 | #include "export.h"
6 | #include "randombytes.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | SODIUM_EXPORT
13 | extern struct randombytes_implementation randombytes_sysrandom_implementation;
14 |
15 | #ifdef __cplusplus
16 | }
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/libsodium/sodium/runtime.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_runtime_H
3 | #define sodium_runtime_H
4 |
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | SODIUM_EXPORT_WEAK
12 | int sodium_runtime_has_neon(void);
13 |
14 | SODIUM_EXPORT_WEAK
15 | int sodium_runtime_has_armcrypto(void);
16 |
17 | SODIUM_EXPORT_WEAK
18 | int sodium_runtime_has_sse2(void);
19 |
20 | SODIUM_EXPORT_WEAK
21 | int sodium_runtime_has_sse3(void);
22 |
23 | SODIUM_EXPORT_WEAK
24 | int sodium_runtime_has_ssse3(void);
25 |
26 | SODIUM_EXPORT_WEAK
27 | int sodium_runtime_has_sse41(void);
28 |
29 | SODIUM_EXPORT_WEAK
30 | int sodium_runtime_has_avx(void);
31 |
32 | SODIUM_EXPORT_WEAK
33 | int sodium_runtime_has_avx2(void);
34 |
35 | SODIUM_EXPORT_WEAK
36 | int sodium_runtime_has_avx512f(void);
37 |
38 | SODIUM_EXPORT_WEAK
39 | int sodium_runtime_has_pclmul(void);
40 |
41 | SODIUM_EXPORT_WEAK
42 | int sodium_runtime_has_aesni(void);
43 |
44 | SODIUM_EXPORT_WEAK
45 | int sodium_runtime_has_rdrand(void);
46 |
47 | /* ------------------------------------------------------------------------- */
48 |
49 | int _sodium_runtime_get_cpu_features(void);
50 |
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/libsodium/sodium/version.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_version_H
3 | #define sodium_version_H
4 |
5 | #include "export.h"
6 |
7 | #define SODIUM_VERSION_STRING "1.0.20"
8 |
9 | #define SODIUM_LIBRARY_VERSION_MAJOR 26
10 | #define SODIUM_LIBRARY_VERSION_MINOR 2
11 |
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | SODIUM_EXPORT
18 | const char *sodium_version_string(void);
19 |
20 | SODIUM_EXPORT
21 | int sodium_library_version_major(void);
22 |
23 | SODIUM_EXPORT
24 | int sodium_library_version_minor(void);
25 |
26 | SODIUM_EXPORT
27 | int sodium_library_minimal(void);
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/nlohmann/adl_serializer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | namespace nlohmann
9 | {
10 |
11 | template
12 | struct adl_serializer
13 | {
14 | /*!
15 | @brief convert a JSON value to any value type
16 |
17 | This function is usually called by the `get()` function of the
18 | @ref basic_json class (either explicit or via conversion operators).
19 |
20 | @param[in] j JSON value to read from
21 | @param[in,out] val value to write to
22 | */
23 | template
24 | static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(
25 | noexcept(::nlohmann::from_json(std::forward(j), val)))
26 | -> decltype(::nlohmann::from_json(std::forward(j), val), void())
27 | {
28 | ::nlohmann::from_json(std::forward(j), val);
29 | }
30 |
31 | /*!
32 | @brief convert any value type to a JSON value
33 |
34 | This function is usually called by the constructors of the @ref basic_json
35 | class.
36 |
37 | @param[in,out] j JSON value to write to
38 | @param[in] val value to read from
39 | */
40 | template
41 | static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
42 | noexcept(::nlohmann::to_json(j, std::forward(val))))
43 | -> decltype(::nlohmann::to_json(j, std::forward(val)), void())
44 | {
45 | ::nlohmann::to_json(j, std::forward(val));
46 | }
47 | };
48 |
49 | } // namespace nlohmann
50 |
--------------------------------------------------------------------------------
/nlohmann/detail/hash.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include // size_t, uint8_t
4 | #include // hash
5 |
6 | namespace nlohmann
7 | {
8 | namespace detail
9 | {
10 |
11 | // boost::hash_combine
12 | inline std::size_t combine(std::size_t seed, std::size_t h) noexcept
13 | {
14 | seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U);
15 | return seed;
16 | }
17 |
18 | /*!
19 | @brief hash a JSON value
20 |
21 | The hash function tries to rely on std::hash where possible. Furthermore, the
22 | type of the JSON value is taken into account to have different hash values for
23 | null, 0, 0U, and false, etc.
24 |
25 | @tparam BasicJsonType basic_json specialization
26 | @param j JSON value to hash
27 | @return hash value of j
28 | */
29 | template
30 | std::size_t hash(const BasicJsonType& j)
31 | {
32 | using string_t = typename BasicJsonType::string_t;
33 | using number_integer_t = typename BasicJsonType::number_integer_t;
34 | using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
35 | using number_float_t = typename BasicJsonType::number_float_t;
36 |
37 | const auto type = static_cast(j.type());
38 | switch (j.type())
39 | {
40 | case BasicJsonType::value_t::null:
41 | case BasicJsonType::value_t::discarded:
42 | {
43 | return combine(type, 0);
44 | }
45 |
46 | case BasicJsonType::value_t::object:
47 | {
48 | auto seed = combine(type, j.size());
49 | for (const auto& element : j.items())
50 | {
51 | const auto h = std::hash {}(element.key());
52 | seed = combine(seed, h);
53 | seed = combine(seed, hash(element.value()));
54 | }
55 | return seed;
56 | }
57 |
58 | case BasicJsonType::value_t::array:
59 | {
60 | auto seed = combine(type, j.size());
61 | for (const auto& element : j)
62 | {
63 | seed = combine(seed, hash(element));
64 | }
65 | return seed;
66 | }
67 |
68 | case BasicJsonType::value_t::string:
69 | {
70 | const auto h = std::hash {}(j.template get_ref());
71 | return combine(type, h);
72 | }
73 |
74 | case BasicJsonType::value_t::boolean:
75 | {
76 | const auto h = std::hash {}(j.template get());
77 | return combine(type, h);
78 | }
79 |
80 | case BasicJsonType::value_t::number_integer:
81 | {
82 | const auto h = std::hash {}(j.template get());
83 | return combine(type, h);
84 | }
85 |
86 | case nlohmann::detail::value_t::number_unsigned:
87 | {
88 | const auto h = std::hash {}(j.template get());
89 | return combine(type, h);
90 | }
91 |
92 | case nlohmann::detail::value_t::number_float:
93 | {
94 | const auto h = std::hash {}(j.template get());
95 | return combine(type, h);
96 | }
97 |
98 | case nlohmann::detail::value_t::binary:
99 | {
100 | auto seed = combine(type, j.get_binary().size());
101 | const auto h = std::hash {}(j.get_binary().has_subtype());
102 | seed = combine(seed, h);
103 | seed = combine(seed, j.get_binary().subtype());
104 | for (const auto byte : j.get_binary())
105 | {
106 | seed = combine(seed, std::hash {}(byte));
107 | }
108 | return seed;
109 | }
110 |
111 | default: // LCOV_EXCL_LINE
112 | JSON_ASSERT(false); // LCOV_EXCL_LINE
113 | }
114 | }
115 |
116 | } // namespace detail
117 | } // namespace nlohmann
118 |
--------------------------------------------------------------------------------
/nlohmann/detail/input/position_t.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include // size_t
4 |
5 | namespace nlohmann
6 | {
7 | namespace detail
8 | {
9 | /// struct to capture the start position of the current token
10 | struct position_t
11 | {
12 | /// the total number of characters read
13 | std::size_t chars_read_total = 0;
14 | /// the number of characters read in the current line
15 | std::size_t chars_read_current_line = 0;
16 | /// the number of lines read
17 | std::size_t lines_read = 0;
18 |
19 | /// conversion to size_t to preserve SAX interface
20 | constexpr operator size_t() const
21 | {
22 | return chars_read_total;
23 | }
24 | };
25 |
26 | } // namespace detail
27 | } // namespace nlohmann
28 |
--------------------------------------------------------------------------------
/nlohmann/detail/iterators/internal_iterator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace nlohmann
6 | {
7 | namespace detail
8 | {
9 | /*!
10 | @brief an iterator value
11 |
12 | @note This structure could easily be a union, but MSVC currently does not allow
13 | unions members with complex constructors, see https://github.com/nlohmann/json/pull/105.
14 | */
15 | template struct internal_iterator
16 | {
17 | /// iterator for JSON objects
18 | typename BasicJsonType::object_t::iterator object_iterator {};
19 | /// iterator for JSON arrays
20 | typename BasicJsonType::array_t::iterator array_iterator {};
21 | /// generic iterator for all other types
22 | primitive_iterator_t primitive_iterator {};
23 | };
24 | } // namespace detail
25 | } // namespace nlohmann
26 |
--------------------------------------------------------------------------------
/nlohmann/detail/iterators/iterator_traits.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include // random_access_iterator_tag
4 |
5 | #include
6 | #include
7 |
8 | namespace nlohmann
9 | {
10 | namespace detail
11 | {
12 | template
13 | struct iterator_types {};
14 |
15 | template
16 | struct iterator_types <
17 | It,
18 | void_t>
20 | {
21 | using difference_type = typename It::difference_type;
22 | using value_type = typename It::value_type;
23 | using pointer = typename It::pointer;
24 | using reference = typename It::reference;
25 | using iterator_category = typename It::iterator_category;
26 | };
27 |
28 | // This is required as some compilers implement std::iterator_traits in a way that
29 | // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341.
30 | template
31 | struct iterator_traits
32 | {
33 | };
34 |
35 | template
36 | struct iterator_traits < T, enable_if_t < !std::is_pointer::value >>
37 | : iterator_types
38 | {
39 | };
40 |
41 | template
42 | struct iterator_traits::value>>
43 | {
44 | using iterator_category = std::random_access_iterator_tag;
45 | using value_type = T;
46 | using difference_type = ptrdiff_t;
47 | using pointer = T*;
48 | using reference = T&;
49 | };
50 | } // namespace detail
51 | } // namespace nlohmann
52 |
--------------------------------------------------------------------------------
/nlohmann/detail/iterators/json_reverse_iterator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include // ptrdiff_t
4 | #include // reverse_iterator
5 | #include // declval
6 |
7 | namespace nlohmann
8 | {
9 | namespace detail
10 | {
11 | //////////////////////
12 | // reverse_iterator //
13 | //////////////////////
14 |
15 | /*!
16 | @brief a template for a reverse iterator class
17 |
18 | @tparam Base the base iterator type to reverse. Valid types are @ref
19 | iterator (to create @ref reverse_iterator) and @ref const_iterator (to
20 | create @ref const_reverse_iterator).
21 |
22 | @requirement The class satisfies the following concept requirements:
23 | -
24 | [BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):
25 | The iterator that can be moved can be moved in both directions (i.e.
26 | incremented and decremented).
27 | - [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator):
28 | It is possible to write to the pointed-to element (only if @a Base is
29 | @ref iterator).
30 |
31 | @since version 1.0.0
32 | */
33 | template
34 | class json_reverse_iterator : public std::reverse_iterator
35 | {
36 | public:
37 | using difference_type = std::ptrdiff_t;
38 | /// shortcut to the reverse iterator adapter
39 | using base_iterator = std::reverse_iterator;
40 | /// the reference type for the pointed-to element
41 | using reference = typename Base::reference;
42 |
43 | /// create reverse iterator from iterator
44 | explicit json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept
45 | : base_iterator(it) {}
46 |
47 | /// create reverse iterator from base class
48 | explicit json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {}
49 |
50 | /// post-increment (it++)
51 | json_reverse_iterator const operator++(int)
52 | {
53 | return static_cast(base_iterator::operator++(1));
54 | }
55 |
56 | /// pre-increment (++it)
57 | json_reverse_iterator& operator++()
58 | {
59 | return static_cast(base_iterator::operator++());
60 | }
61 |
62 | /// post-decrement (it--)
63 | json_reverse_iterator const operator--(int)
64 | {
65 | return static_cast(base_iterator::operator--(1));
66 | }
67 |
68 | /// pre-decrement (--it)
69 | json_reverse_iterator& operator--()
70 | {
71 | return static_cast(base_iterator::operator--());
72 | }
73 |
74 | /// add to iterator
75 | json_reverse_iterator& operator+=(difference_type i)
76 | {
77 | return static_cast(base_iterator::operator+=(i));
78 | }
79 |
80 | /// add to iterator
81 | json_reverse_iterator operator+(difference_type i) const
82 | {
83 | return static_cast(base_iterator::operator+(i));
84 | }
85 |
86 | /// subtract from iterator
87 | json_reverse_iterator operator-(difference_type i) const
88 | {
89 | return static_cast(base_iterator::operator-(i));
90 | }
91 |
92 | /// return difference
93 | difference_type operator-(const json_reverse_iterator& other) const
94 | {
95 | return base_iterator(*this) - base_iterator(other);
96 | }
97 |
98 | /// access to successor
99 | reference operator[](difference_type n) const
100 | {
101 | return *(this->operator+(n));
102 | }
103 |
104 | /// return the key of an object iterator
105 | auto key() const -> decltype(std::declval().key())
106 | {
107 | auto it = --this->base();
108 | return it.key();
109 | }
110 |
111 | /// return the value of an iterator
112 | reference value() const
113 | {
114 | auto it = --this->base();
115 | return it.operator * ();
116 | }
117 | };
118 | } // namespace detail
119 | } // namespace nlohmann
120 |
--------------------------------------------------------------------------------
/nlohmann/detail/iterators/primitive_iterator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include // ptrdiff_t
4 | #include // numeric_limits
5 |
6 | namespace nlohmann
7 | {
8 | namespace detail
9 | {
10 | /*
11 | @brief an iterator for primitive JSON types
12 |
13 | This class models an iterator for primitive JSON types (boolean, number,
14 | string). It's only purpose is to allow the iterator/const_iterator classes
15 | to "iterate" over primitive values. Internally, the iterator is modeled by
16 | a `difference_type` variable. Value begin_value (`0`) models the begin,
17 | end_value (`1`) models past the end.
18 | */
19 | class primitive_iterator_t
20 | {
21 | private:
22 | using difference_type = std::ptrdiff_t;
23 | static constexpr difference_type begin_value = 0;
24 | static constexpr difference_type end_value = begin_value + 1;
25 |
26 | /// iterator as signed integer type
27 | difference_type m_it = (std::numeric_limits::min)();
28 |
29 | public:
30 | constexpr difference_type get_value() const noexcept
31 | {
32 | return m_it;
33 | }
34 |
35 | /// set iterator to a defined beginning
36 | void set_begin() noexcept
37 | {
38 | m_it = begin_value;
39 | }
40 |
41 | /// set iterator to a defined past the end
42 | void set_end() noexcept
43 | {
44 | m_it = end_value;
45 | }
46 |
47 | /// return whether the iterator can be dereferenced
48 | constexpr bool is_begin() const noexcept
49 | {
50 | return m_it == begin_value;
51 | }
52 |
53 | /// return whether the iterator is at end
54 | constexpr bool is_end() const noexcept
55 | {
56 | return m_it == end_value;
57 | }
58 |
59 | friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
60 | {
61 | return lhs.m_it == rhs.m_it;
62 | }
63 |
64 | friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
65 | {
66 | return lhs.m_it < rhs.m_it;
67 | }
68 |
69 | primitive_iterator_t operator+(difference_type n) noexcept
70 | {
71 | auto result = *this;
72 | result += n;
73 | return result;
74 | }
75 |
76 | friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
77 | {
78 | return lhs.m_it - rhs.m_it;
79 | }
80 |
81 | primitive_iterator_t& operator++() noexcept
82 | {
83 | ++m_it;
84 | return *this;
85 | }
86 |
87 | primitive_iterator_t const operator++(int) noexcept
88 | {
89 | auto result = *this;
90 | ++m_it;
91 | return result;
92 | }
93 |
94 | primitive_iterator_t& operator--() noexcept
95 | {
96 | --m_it;
97 | return *this;
98 | }
99 |
100 | primitive_iterator_t const operator--(int) noexcept
101 | {
102 | auto result = *this;
103 | --m_it;
104 | return result;
105 | }
106 |
107 | primitive_iterator_t& operator+=(difference_type n) noexcept
108 | {
109 | m_it += n;
110 | return *this;
111 | }
112 |
113 | primitive_iterator_t& operator-=(difference_type n) noexcept
114 | {
115 | m_it -= n;
116 | return *this;
117 | }
118 | };
119 | } // namespace detail
120 | } // namespace nlohmann
121 |
--------------------------------------------------------------------------------
/nlohmann/detail/json_ref.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | namespace nlohmann
9 | {
10 | namespace detail
11 | {
12 | template
13 | class json_ref
14 | {
15 | public:
16 | using value_type = BasicJsonType;
17 |
18 | json_ref(value_type&& value)
19 | : owned_value(std::move(value))
20 | , value_ref(&owned_value)
21 | , is_rvalue(true)
22 | {}
23 |
24 | json_ref(const value_type& value)
25 | : value_ref(const_cast(&value))
26 | , is_rvalue(false)
27 | {}
28 |
29 | json_ref(std::initializer_list init)
30 | : owned_value(init)
31 | , value_ref(&owned_value)
32 | , is_rvalue(true)
33 | {}
34 |
35 | template <
36 | class... Args,
37 | enable_if_t::value, int> = 0 >
38 | json_ref(Args && ... args)
39 | : owned_value(std::forward(args)...)
40 | , value_ref(&owned_value)
41 | , is_rvalue(true)
42 | {}
43 |
44 | // class should be movable only
45 | json_ref(json_ref&&) = default;
46 | json_ref(const json_ref&) = delete;
47 | json_ref& operator=(const json_ref&) = delete;
48 | json_ref& operator=(json_ref&&) = delete;
49 | ~json_ref() = default;
50 |
51 | value_type moved_or_copied() const
52 | {
53 | if (is_rvalue)
54 | {
55 | return std::move(*value_ref);
56 | }
57 | return *value_ref;
58 | }
59 |
60 | value_type const& operator*() const
61 | {
62 | return *static_cast(value_ref);
63 | }
64 |
65 | value_type const* operator->() const
66 | {
67 | return static_cast(value_ref);
68 | }
69 |
70 | private:
71 | mutable value_type owned_value = nullptr;
72 | value_type* value_ref = nullptr;
73 | const bool is_rvalue = true;
74 | };
75 | } // namespace detail
76 | } // namespace nlohmann
77 |
--------------------------------------------------------------------------------
/nlohmann/detail/macro_unscope.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // restore GCC/clang diagnostic settings
4 | #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
5 | #pragma GCC diagnostic pop
6 | #endif
7 | #if defined(__clang__)
8 | #pragma GCC diagnostic pop
9 | #endif
10 |
11 | // clean up
12 | #undef JSON_ASSERT
13 | #undef JSON_INTERNAL_CATCH
14 | #undef JSON_CATCH
15 | #undef JSON_THROW
16 | #undef JSON_TRY
17 | #undef JSON_HAS_CPP_14
18 | #undef JSON_HAS_CPP_17
19 | #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
20 | #undef NLOHMANN_BASIC_JSON_TPL
21 | #undef JSON_EXPLICIT
22 |
23 | #include
24 |
--------------------------------------------------------------------------------
/nlohmann/detail/meta/cpp_future.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include // size_t
4 | #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
5 |
6 | namespace nlohmann
7 | {
8 | namespace detail
9 | {
10 | // alias templates to reduce boilerplate
11 | template
12 | using enable_if_t = typename std::enable_if::type;
13 |
14 | template
15 | using uncvref_t = typename std::remove_cv::type>::type;
16 |
17 | // implementation of C++14 index_sequence and affiliates
18 | // source: https://stackoverflow.com/a/32223343
19 | template
20 | struct index_sequence
21 | {
22 | using type = index_sequence;
23 | using value_type = std::size_t;
24 | static constexpr std::size_t size() noexcept
25 | {
26 | return sizeof...(Ints);
27 | }
28 | };
29 |
30 | template
31 | struct merge_and_renumber;
32 |
33 | template
34 | struct merge_and_renumber, index_sequence>
35 | : index_sequence < I1..., (sizeof...(I1) + I2)... > {};
36 |
37 | template
38 | struct make_index_sequence
39 | : merge_and_renumber < typename make_index_sequence < N / 2 >::type,
40 | typename make_index_sequence < N - N / 2 >::type > {};
41 |
42 | template<> struct make_index_sequence<0> : index_sequence<> {};
43 | template<> struct make_index_sequence<1> : index_sequence<0> {};
44 |
45 | template
46 | using index_sequence_for = make_index_sequence;
47 |
48 | // dispatch utility (taken from ranges-v3)
49 | template struct priority_tag : priority_tag < N - 1 > {};
50 | template<> struct priority_tag<0> {};
51 |
52 | // taken from ranges-v3
53 | template
54 | struct static_const
55 | {
56 | static constexpr T value{};
57 | };
58 |
59 | template
60 | constexpr T static_const::value;
61 | } // namespace detail
62 | } // namespace nlohmann
63 |
--------------------------------------------------------------------------------
/nlohmann/detail/meta/detected.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | // https://en.cppreference.com/w/cpp/experimental/is_detected
8 | namespace nlohmann
9 | {
10 | namespace detail
11 | {
12 | struct nonesuch
13 | {
14 | nonesuch() = delete;
15 | ~nonesuch() = delete;
16 | nonesuch(nonesuch const&) = delete;
17 | nonesuch(nonesuch const&&) = delete;
18 | void operator=(nonesuch const&) = delete;
19 | void operator=(nonesuch&&) = delete;
20 | };
21 |
22 | template class Op,
25 | class... Args>
26 | struct detector
27 | {
28 | using value_t = std::false_type;
29 | using type = Default;
30 | };
31 |
32 | template class Op, class... Args>
33 | struct detector>, Op, Args...>
34 | {
35 | using value_t = std::true_type;
36 | using type = Op;
37 | };
38 |
39 | template class Op, class... Args>
40 | using is_detected = typename detector::value_t;
41 |
42 | template class Op, class... Args>
43 | using detected_t = typename detector::type;
44 |
45 | template class Op, class... Args>
46 | using detected_or = detector;
47 |
48 | template class Op, class... Args>
49 | using detected_or_t = typename detected_or::type;
50 |
51 | template class Op, class... Args>
52 | using is_detected_exact = std::is_same>;
53 |
54 | template class Op, class... Args>
55 | using is_detected_convertible =
56 | std::is_convertible, To>;
57 | } // namespace detail
58 | } // namespace nlohmann
59 |
--------------------------------------------------------------------------------
/nlohmann/detail/meta/void_t.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace nlohmann
4 | {
5 | namespace detail
6 | {
7 | template struct make_void
8 | {
9 | using type = void;
10 | };
11 | template using void_t = typename make_void::type;
12 | } // namespace detail
13 | } // namespace nlohmann
14 |
--------------------------------------------------------------------------------
/nlohmann/detail/output/output_adapters.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include // copy
4 | #include // size_t
5 | #include // streamsize
6 | #include // back_inserter
7 | #include // shared_ptr, make_shared
8 | #include // basic_ostream
9 | #include // basic_string
10 | #include // vector
11 | #include
12 |
13 | namespace nlohmann
14 | {
15 | namespace detail
16 | {
17 | /// abstract output adapter interface
18 | template struct output_adapter_protocol
19 | {
20 | virtual void write_character(CharType c) = 0;
21 | virtual void write_characters(const CharType* s, std::size_t length) = 0;
22 | virtual ~output_adapter_protocol() = default;
23 | };
24 |
25 | /// a type to simplify interfaces
26 | template
27 | using output_adapter_t = std::shared_ptr>;
28 |
29 | /// output adapter for byte vectors
30 | template
31 | class output_vector_adapter : public output_adapter_protocol
32 | {
33 | public:
34 | explicit output_vector_adapter(std::vector& vec) noexcept
35 | : v(vec)
36 | {}
37 |
38 | void write_character(CharType c) override
39 | {
40 | v.push_back(c);
41 | }
42 |
43 | JSON_HEDLEY_NON_NULL(2)
44 | void write_characters(const CharType* s, std::size_t length) override
45 | {
46 | std::copy(s, s + length, std::back_inserter(v));
47 | }
48 |
49 | private:
50 | std::vector& v;
51 | };
52 |
53 | /// output adapter for output streams
54 | template
55 | class output_stream_adapter : public output_adapter_protocol
56 | {
57 | public:
58 | explicit output_stream_adapter(std::basic_ostream& s) noexcept
59 | : stream(s)
60 | {}
61 |
62 | void write_character(CharType c) override
63 | {
64 | stream.put(c);
65 | }
66 |
67 | JSON_HEDLEY_NON_NULL(2)
68 | void write_characters(const CharType* s, std::size_t length) override
69 | {
70 | stream.write(s, static_cast