1
0
Fork 0
mirror of https://github.com/eosswedenorg/libantelope synced 2026-06-16 19:50:01 +02:00

Compare commits

..

3 commits

3 changed files with 45 additions and 67 deletions

View file

@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.15)
# Project name and version # Project name and version
project(libantelope project(libantelope
VERSION 0.2.1 VERSION 0.2.2
DESCRIPTION "C++ library for Antelope IO" DESCRIPTION "C++ library for Antelope IO"
HOMEPAGE_URL "https://github.com/eosswedenorg/libantelope" HOMEPAGE_URL "https://github.com/eosswedenorg/libantelope"
LANGUAGES C CXX LANGUAGES C CXX

109
README.md
View file

@ -4,130 +4,107 @@
# libantelope # libantelope
Independent C++ library for [Antelope IO](https://antelope.io) (former [libeosio](https://github.com/eosswedenorg/libeosio)) libantelope is an independent C++ library designed for Antelope IO (formerly known as libeosio). Please note that this repository is not affiliated with the official Antelope code.
NOTE: This repository has no connection to the official Antelope code.
## Compiling the library ## Compiling the library
You will need `openssl` development files (version 1.1 or later) to compile and `cmake 3.15` or later to compile this project. To compile this project, you will need the following:
- `openssl` development files (version 1.1 or later)
- `cmake 3.15` or later
### Elliptic curve backend ### Elliptic curve backend
There is two different backend implementation for the elliptic curve part of the library: The library offers two different backend implementations for the elliptic curve functionality:
* `OpenSSL` as mentioned before. however you still need to link to openssl even if it is not used as the EC backend - `libsecp256k1`
because more of the codebase uses it. - `OpenSSL`: Although the default is to use `libsecp256k1` for optimization, you still need to link to OpenSSL as other parts of the codebase rely on it.
* `libsecp256k1` To switch the implementation, modify the `EC_LIB` variable in the cmake.
Default is to use `libsecp256k1` as it is more optimized.
You can switch implementation by modifing the cmake variable `EC_LIB`.
### CMake ### CMake
You can install `cmake` by reading the [official guide](https://cmake.org/install). You can install `cmake` by referring to the [official guide](https://cmake.org/install).
### Linux ### Linux
**NOTE:** Only Ubuntu `20.04` and `22.04` is officially supported. **NOTE:** Only Ubuntu versions `20.04` and `22.04` are officially supported.
The project should compile fine on most versions/distros but it is only tested While the project should compile fine on most versions/distros, it is only tested and distributed for Ubuntu `20.04` and `22.04` by [Sw/eden](https://www.eossweden.org).
and distributed for Ubuntu `20.04` and `22.04` by [Sw/eden](https://www.eossweden.org).
#### Dependencies #### Dependencies
**Ubuntu (or other debian based distros)** **Ubuntu (or other Debian-based distros)**
First you need to have a compiler, `openssl` and `cmake`. this can be installed with apt. To install the necessary dependencies (compiler, `openssl`, and `cmake`), use the following `apt` command:
```sh ```sh
$ apt-get install gcc g++ cmake libssl-dev apt-get install gcc g++ cmake libssl-dev
``` ```
If you need a newer version of cmake then apt provides.
Checkout the official [CMake APT repository](https://apt.kitware.com/). If you require a newer version of `cmake`, you can refer to the [official CMake APT repository](https://apt.kitware.com/).
**Other** **Other**
Consult your package manager's manual for getting `openssl`,`g++` and `cmake` installed. For other distros, please consult your package manager's manual to install `openssl`, `g++`, and `cmake`. If you need a newer version of `cmake`, you can follow the [official installation guide](https://cmake.org/install).
If you need a newer version of cmake then your package manager provides. checkout the [official guide](https://cmake.org/install).
### MacOS ### MacOS
#### Dependencies #### Dependencies
You must have a compiler installed. This project is known to build with `Xcode 11.0` but other versions should work. Ensure that you have a compiler installed. This project is known to build with `Xcode 11.0`, but other versions should work as well.
To install `openssl` and `cmake`, you can use the following `brew` command:
You need to have openssl and cmake installed also, this can be done with this `brew` command:
```sh ```sh
$ brew install openssl cmake brew install openssl cmake
``` ```
If you need a newer version of cmake then brew provides. checkout the [official guide](https://cmake.org/install) If you require a newer version of `cmake`, refer to the [official installation guide](https://cmake.org/install).
#### Build #### Build
```sh ```sh
$ mkdir build && cd build mkdir build && cd build
$ cmake .. && make cmake .. && make
``` ```
**MacOS:** You may need to point `cmake` to `openssl` by passing the argument **MacOS:** If your `openssl` installation is not located at `/usr/local/opt/openssl@1.1`, you may need to pass the argument `-D OPENSSL_ROOT_DIR=/path/to/openssl` to `cmake` and specify the correct path.
`-D OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1` if openssl is not under `/usr/local/opt/openssl@1.1` you need to find the correct path.
### Windows ### Windows
#### Dependencies #### Dependencies
First you will need a compiler. First, ensure that you have a compiler installed.
[Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16) (Selecting C++ during installation) is recommended. It is recommended to use [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16) and select C++ during installation.
By default `cmake` will use the bundled openssl package located at `vendor/openssl-1.1.1e-win-static.zip` By default, `cmake` will utilize the bundled OpenSSL package located at `vendor/openssl-1.1.1e-win-static.zip`. If you prefer to use a different version of OpenSSL, set the `OPENSSL_ROOT_DIR` to the directory where OpenSSL is located on your system:
If you like to use an other version of OpenSSL then the static one bundled with this repo ```sh
you need to set `OPENSSL_ROOT_DIR` to the directory where OpenSSL is located on the system. cmake -D OPENSSL_ROOT_DIR=C:/path/to/openssl -B build
For example:
```
C:\repo> cmake -D OPENSSL_ROOT_DIR=C:/path/to/openssl -B build
``` ```
**NOTE:** `cmake` uses forward slash `/` for path even for windows. so make sure you use that when setting `OPENSSL_ROOT_DIR` **NOTE:** `cmake` uses forward slashes `/` for paths, even on Windows, so ensure that you use them when setting
#### Build. `OPENSSL_ROOT_DIR`.
Run cmake #### Build
``` Run `cmake`:
C:\repo> cmake -B build
C:\repo> cmake --build build --config Release ```sh
cmake -B build
cmake --build build --config Release
``` ```
## Security notice ## Security Notice
Elliptic curve crypthographic operations is done using either `OpenSSL` or `libsecp256k1` libraries. The library performs elliptic curve cryptographic operations using either the `OpenSSL` or `libsecp256k1` libraries. The `libantelope` library ensures that sensitive cryptographic information is only stored in computer memory and not exposed to external sources. You are encouraged to inspect the source code and compile it yourself for verification purposes.
This library (libantelope) will never expose sensitve cryptographic information
to anything but the computers memory.
You are free to inspect the source code and compile yourself to verify.
However, use this at your own risk. we cannot guarantee that the keys are However, please use this library at your own risk. While both OpenSSL and libsecp256k1 are widely used and considered safe, we cannot guarantee the cryptographic security of the keys as it depends on the elliptic curve implementation.
cryptographically secure as this depends on the elliptic curve
implementation (alto both OpenSSL and libsecp256k1 are widely used and should be safe)
Please read the `LICENSE` file. Please refer to the `LICENSE` file for more information.
```
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
## Author ## Author

View file

@ -25,6 +25,7 @@
* Based on code from https://github.com/bitcoin/bitcoin/blob/f1e2f2a85962c1664e4e55471061af0eaa798d40/src/base58.cpp * Based on code from https://github.com/bitcoin/bitcoin/blob/f1e2f2a85962c1664e4e55471061af0eaa798d40/src/base58.cpp
*/ */
#include <algorithm> #include <algorithm>
#include <cstdint>
#include <cstddef> #include <cstddef>
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>