|
purify
C++ Purify implementation with native circuit and BPP support
|
#include "core.h"#include <stddef.h>#include <stdlib.h>#include <string.h>#include "purify/secp_bridge.h"#include <errno.h>#include <stdio.h>#include <unistd.h>Go to the source code of this file.
Functions | |
| static void | purify_core_secure_clear (void *data, size_t size) |
| static int | purify_core_compare_be (const unsigned char *lhs, const unsigned char *rhs, size_t size) |
| static purify_error_code | purify_core_validate_below (const unsigned char *value, size_t size, const unsigned char *upper_bound) |
| static purify_error_code | purify_core_hkdf_sha256 (unsigned char *out, size_t out_len, const unsigned char *ikm, size_t ikm_len, const unsigned char *salt, size_t salt_len, const unsigned char *info, size_t info_len) |
| const char * | purify_error_name (purify_error_code code) |
| Returns a stable programmatic name for one status code. | |
| const char * | purify_error_message (purify_error_code code) |
| Returns a human-facing description for one status code. | |
| purify_error_code | purify_fill_secure_random (unsigned char *bytes, size_t bytes_len) |
| Fills a caller-owned buffer with secure operating-system randomness. | |
| purify_error_code | purify_validate_secret_key (const unsigned char secret_key[PURIFY_SECRET_KEY_BYTES]) |
| Validates one packed Purify secret key. | |
| purify_error_code | purify_validate_public_key (const unsigned char public_key[PURIFY_PUBLIC_KEY_BYTES]) |
| Validates one packed Purify public key. | |
| purify_error_code | purify_core_sample_secret_key (unsigned char out_secret_key[PURIFY_SECRET_KEY_BYTES]) |
| purify_error_code | purify_core_seed_secret_key (unsigned char out_secret_key[PURIFY_SECRET_KEY_BYTES], const unsigned char *seed, size_t seed_len) |
Variables | |
| static const unsigned char | kPackedSecretKeySpaceSize [PURIFY_SECRET_KEY_BYTES] |
| static const unsigned char | kPackedPublicKeySpaceSize [PURIFY_PUBLIC_KEY_BYTES] |
| static const char *const | kErrorNames [] |
| static const char *const | kErrorMessages [] |
|
static |
Definition at line 147 of file core.c.
Referenced by purify_core_sample_secret_key(), purify_core_seed_secret_key(), and purify_core_validate_below().
|
static |
Definition at line 172 of file core.c.
References purify_core_secure_clear(), PURIFY_ERROR_INTERNAL_MISMATCH, PURIFY_ERROR_MISSING_VALUE, PURIFY_ERROR_OK, and purify_hmac_sha256().
Referenced by purify_core_seed_secret_key().
| purify_error_code purify_core_sample_secret_key | ( | unsigned char | out_secret_key[PURIFY_SECRET_KEY_BYTES] | ) |
Definition at line 315 of file core.c.
References kPackedSecretKeySpaceSize, purify_core_compare_be(), purify_core_secure_clear(), PURIFY_ERROR_MISSING_VALUE, PURIFY_ERROR_OK, purify_fill_secure_random(), and PURIFY_SECRET_KEY_BYTES.
Referenced by purify_generate_key().
|
static |
Definition at line 138 of file core.c.
Referenced by purify_core_hkdf_sha256(), purify_core_sample_secret_key(), and purify_core_seed_secret_key().
| purify_error_code purify_core_seed_secret_key | ( | unsigned char | out_secret_key[PURIFY_SECRET_KEY_BYTES], |
| const unsigned char * | seed, | ||
| size_t | seed_len | ||
| ) |
Definition at line 334 of file core.c.
References kPackedSecretKeySpaceSize, purify_core_compare_be(), purify_core_hkdf_sha256(), purify_core_secure_clear(), PURIFY_ERROR_INTERNAL_MISMATCH, PURIFY_ERROR_MISSING_VALUE, PURIFY_ERROR_OK, PURIFY_ERROR_RANGE_VIOLATION, and PURIFY_SECRET_KEY_BYTES.
Referenced by purify_generate_key_from_seed().
|
static |
Definition at line 160 of file core.c.
References purify_core_compare_be(), PURIFY_ERROR_MISSING_VALUE, PURIFY_ERROR_OK, and PURIFY_ERROR_RANGE_VIOLATION.
Referenced by purify_validate_public_key(), and purify_validate_secret_key().
| const char * purify_error_message | ( | purify_error_code | code | ) |
Definition at line 251 of file core.c.
References kErrorMessages.
| const char * purify_error_name | ( | purify_error_code | code | ) |
Definition at line 242 of file core.c.
References kErrorNames.
| purify_error_code purify_fill_secure_random | ( | unsigned char * | bytes, |
| size_t | bytes_len | ||
| ) |
| bytes | Buffer to fill. May be NULL only when bytes_len == 0. |
| bytes_len | Buffer length in bytes. |
PURIFY_ERROR_OK on success. Definition at line 260 of file core.c.
References PURIFY_ERROR_ENTROPY_UNAVAILABLE, PURIFY_ERROR_MISSING_VALUE, and PURIFY_ERROR_OK.
Referenced by purify::fill_secure_random(), purify_core_sample_secret_key(), and purify_secp_context_create().
| purify_error_code purify_validate_public_key | ( | const unsigned char | public_key[PURIFY_PUBLIC_KEY_BYTES] | ) |
| public_key | 64-byte packed Purify public key. |
PURIFY_ERROR_OK when the packed public key is canonical. Definition at line 311 of file core.c.
References kPackedPublicKeySpaceSize, purify_core_validate_below(), and PURIFY_PUBLIC_KEY_BYTES.
Referenced by purify::capi_detail::parse_public_key().
| purify_error_code purify_validate_secret_key | ( | const unsigned char | secret_key[PURIFY_SECRET_KEY_BYTES] | ) |
| secret_key | 64-byte packed Purify secret. |
PURIFY_ERROR_OK when the packed secret is canonical. Definition at line 307 of file core.c.
References kPackedSecretKeySpaceSize, purify_core_validate_below(), and PURIFY_SECRET_KEY_BYTES.
Referenced by purify::capi_detail::parse_secret_key().
|
static |
Definition at line 105 of file core.c.
Referenced by purify_error_message().
|
static |
Definition at line 72 of file core.c.
Referenced by purify_error_name().
|
static |
Definition at line 61 of file core.c.
Referenced by purify_validate_public_key().
|
static |
Definition at line 42 of file core.c.
Referenced by purify_core_sample_secret_key(), purify_core_seed_secret_key(), and purify_validate_secret_key().