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

Compare commits

..

No commits in common. "master" and "v0.2.1" have entirely different histories.

3 changed files with 67 additions and 45 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.2 VERSION 0.2.1
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,107 +4,130 @@
# libantelope # libantelope
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. Independent C++ library for [Antelope IO](https://antelope.io) (former [libeosio](https://github.com/eosswedenorg/libeosio))
NOTE: This repository has no connection to the official Antelope code.
## Compiling the library ## Compiling the library
To compile this project, you will need the following: You will need `openssl` development files (version 1.1 or later) to compile and `cmake 3.15` or later to compile this project.
- `openssl` development files (version 1.1 or later)
- `cmake 3.15` or later
### Elliptic curve backend ### Elliptic curve backend
The library offers two different backend implementations for the elliptic curve functionality: There is two different backend implementation for the elliptic curve part of the library:
- `libsecp256k1` * `OpenSSL` as mentioned before. however you still need to link to openssl even if it is not used as the EC backend
- `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. because more of the codebase uses it.
To switch the implementation, modify the `EC_LIB` variable in the cmake. * `libsecp256k1`
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 referring to the [official guide](https://cmake.org/install). You can install `cmake` by reading the [official guide](https://cmake.org/install).
### Linux ### Linux
**NOTE:** Only Ubuntu versions `20.04` and `22.04` are officially supported. **NOTE:** Only Ubuntu `20.04` and `22.04` is officially supported.
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). The project should compile fine on most versions/distros but it is only tested
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)**
To install the necessary dependencies (compiler, `openssl`, and `cmake`), use the following `apt` command: First you need to have a compiler, `openssl` and `cmake`. this can be installed with apt.
```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.
If you require a newer version of `cmake`, you can refer to the [official CMake APT repository](https://apt.kitware.com/). Checkout the official [CMake APT repository](https://apt.kitware.com/).
**Other** **Other**
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). Consult your package manager's manual for getting `openssl`,`g++` and `cmake` installed.
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
Ensure that you have a compiler installed. This project is known to build with `Xcode 11.0`, but other versions should work as well. You must have a compiler installed. This project is known to build with `Xcode 11.0` but other versions should work.
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 require a newer version of `cmake`, refer to the [official installation guide](https://cmake.org/install). If you need a newer version of cmake then brew provides. checkout the [official guide](https://cmake.org/install)
#### Build #### Build
```sh ```sh
mkdir build && cd build $ mkdir build && cd build
cmake .. && make $ cmake .. && make
``` ```
**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. **MacOS:** You may need to point `cmake` to `openssl` by passing the argument
`-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, ensure that you have a compiler installed. First you will need a compiler.
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. [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.
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: By default `cmake` will use the bundled openssl package located at `vendor/openssl-1.1.1e-win-static.zip`
```sh If you like to use an other version of OpenSSL then the static one bundled with this repo
cmake -D OPENSSL_ROOT_DIR=C:/path/to/openssl -B build you need to set `OPENSSL_ROOT_DIR` to the directory where OpenSSL is located on the system.
For example:
```
C:\repo> cmake -D OPENSSL_ROOT_DIR=C:/path/to/openssl -B build
``` ```
**NOTE:** `cmake` uses forward slashes `/` for paths, even on Windows, so ensure that you use them when setting **NOTE:** `cmake` uses forward slash `/` for path even for windows. so make sure you use that when setting `OPENSSL_ROOT_DIR`
`OPENSSL_ROOT_DIR`. #### Build.
#### Build Run cmake
Run `cmake`: ```
C:\repo> cmake -B build
```sh C:\repo> cmake --build build --config Release
cmake -B build
cmake --build build --config Release
``` ```
## Security Notice ## Security notice
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. Elliptic curve crypthographic operations is done using either `OpenSSL` or `libsecp256k1` libraries.
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, 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. However, use this at your own risk. we cannot guarantee that the keys are
cryptographically secure as this depends on the elliptic curve
implementation (alto both OpenSSL and libsecp256k1 are widely used and should be safe)
Please refer to the `LICENSE` file for more information. Please read the `LICENSE` file.
```
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,7 +25,6 @@
* 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>