28 int md4_vector(
size_t num_elem,
const u8 *addr[],
const size_t *len, u8 *mac);
38 int md5_vector(
size_t num_elem,
const u8 *addr[],
const size_t *len, u8 *mac);
49 int sha1_vector(
size_t num_elem,
const u8 *addr[],
const size_t *len,
64 int __must_check
fips186_2_prf(
const u8 *seed,
size_t seed_len, u8 *x,
75 int sha256_vector(
size_t num_elem,
const u8 *addr[],
const size_t *len,
84 void des_encrypt(
const u8 *clear,
const u8 *key, u8 *cypher);
100 void aes_encrypt(
void *ctx,
const u8 *plain, u8 *crypt);
122 void aes_decrypt(
void *ctx,
const u8 *crypt, u8 *plain);
131 enum crypto_hash_alg {
132 CRYPTO_HASH_ALG_MD5, CRYPTO_HASH_ALG_SHA1,
133 CRYPTO_HASH_ALG_HMAC_MD5, CRYPTO_HASH_ALG_HMAC_SHA1,
134 CRYPTO_HASH_ALG_SHA256, CRYPTO_HASH_ALG_HMAC_SHA256
186 enum crypto_cipher_alg {
187 CRYPTO_CIPHER_NULL = 0, CRYPTO_CIPHER_ALG_AES, CRYPTO_CIPHER_ALG_3DES,
188 CRYPTO_CIPHER_ALG_DES, CRYPTO_CIPHER_ALG_RC2, CRYPTO_CIPHER_ALG_RC4
207 const u8 *iv,
const u8 *key,
223 const u8 *plain, u8 *crypt,
size_t len);
238 const u8 *crypt, u8 *plain,
size_t len);
271 crypto_public_key_import_parts(
const u8 *n,
size_t n_len,
272 const u8 *e,
size_t e_len);
321 u8 *out,
size_t *outlen);
338 u8 *out,
size_t *outlen);
354 const u8 *in,
size_t inlen,
355 u8 *out,
size_t *outlen);
388 u8 *plain,
size_t *plain_len);
431 const u8 *power,
size_t power_len,
432 const u8 *modulus,
size_t modulus_len,
433 u8 *result,
size_t *result_len);
448 int rc4_skip(
const u8 *key,
size_t keylen,
size_t skip,
449 u8 *data,
size_t data_len);
470 struct crypto_bignum;
502 u8 *buf,
size_t buflen,
size_t padlen);
512 const struct crypto_bignum *b,
513 struct crypto_bignum *c);
523 const struct crypto_bignum *b,
524 struct crypto_bignum *c);
535 const struct crypto_bignum *b,
536 const struct crypto_bignum *c,
537 struct crypto_bignum *d);
547 const struct crypto_bignum *b,
548 struct crypto_bignum *c);
558 const struct crypto_bignum *b,
559 struct crypto_bignum *c);
569 const struct crypto_bignum *b,
570 struct crypto_bignum *c);
581 const struct crypto_bignum *b,
582 const struct crypto_bignum *c,
583 struct crypto_bignum *d);
592 const struct crypto_bignum *b);
622 const struct crypto_bignum *p);
682 struct crypto_ec_point;
711 const struct crypto_ec_point *point, u8 *x, u8 *y);
735 const struct crypto_ec_point *b,
736 struct crypto_ec_point *c);
747 const struct crypto_bignum *b,
748 struct crypto_ec_point *res);
767 struct crypto_ec_point *p,
768 const struct crypto_bignum *x,
int y_bit);
776 struct crypto_bignum *
778 const struct crypto_bignum *x);
788 const struct crypto_ec_point *p);
797 const struct crypto_ec_point *p);
807 const struct crypto_ec_point *a,
808 const struct crypto_ec_point *b);
struct crypto_ec_point * crypto_ec_point_from_bin(struct crypto_ec *e, const u8 *val)
Create EC point from binary data.
int crypto_ec_point_invert(struct crypto_ec *e, struct crypto_ec_point *p)
Compute inverse of an EC point.
size_t crypto_ec_prime_len(struct crypto_ec *e)
Get length of the prime in octets.
void crypto_cipher_deinit(struct crypto_cipher *ctx)
Free cipher context.
Definition: crypto_gnutls.c:290
int crypto_bignum_sub(const struct crypto_bignum *a, const struct crypto_bignum *b, struct crypto_bignum *c)
c = a - b
Definition: crypto_openssl.c:1047
Definition: crypto_libtomcrypt.c:403
struct crypto_public_key * crypto_public_key_from_cert(const u8 *buf, size_t len)
Import an RSA public key from a certificate.
Definition: crypto_internal-rsa.c:60
int __must_check crypto_mod_exp(const u8 *base, size_t base_len, const u8 *power, size_t power_len, const u8 *modulus, size_t modulus_len, u8 *result, size_t *result_len)
Modular exponentiation of large integers.
Definition: crypto_gnutls.c:150
int __must_check fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen)
NIST FIPS Publication 186-2 change notice 1 PRF.
Definition: fips_prf_internal.c:13
int crypto_ec_point_solve_y_coord(struct crypto_ec *e, struct crypto_ec_point *p, const struct crypto_bignum *x, int y_bit)
Solve y coordinate for an x coordinate.
int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
SHA256 hash for data vector.
Definition: crypto_openssl.c:175
struct crypto_public_key * crypto_public_key_import(const u8 *key, size_t len)
Import an RSA public key.
Definition: crypto_internal-rsa.c:18
int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
SHA-1 hash for data vector.
Definition: crypto_gnutls.c:69
size_t crypto_ec_prime_len_bits(struct crypto_ec *e)
Get length of the prime in bits.
int crypto_get_random(void *buf, size_t len)
Generate cryptographically strong pseudy-random bytes.
Definition: crypto_openssl.c:875
int crypto_ec_point_add(struct crypto_ec *e, const struct crypto_ec_point *a, const struct crypto_ec_point *b, struct crypto_ec_point *c)
c = a + b
void crypto_bignum_deinit(struct crypto_bignum *n, int clear)
Free bignum.
Definition: crypto_openssl.c:951
int rc4_skip(const u8 *key, size_t keylen, size_t skip, u8 *data, size_t data_len)
XOR RC4 stream to given data with skip-stream-start.
Definition: crypto_openssl.c:122
int __must_check crypto_cipher_decrypt(struct crypto_cipher *ctx, const u8 *crypt, u8 *plain, size_t len)
Cipher decrypt.
Definition: crypto_gnutls.c:280
struct crypto_bignum * crypto_bignum_init(void)
Allocate memory for bignum.
Definition: crypto_openssl.c:938
struct crypto_bignum * crypto_ec_point_compute_y_sqr(struct crypto_ec *e, const struct crypto_bignum *x)
Compute y^2 = x^3 + ax + b.
Definition: crypto_gnutls.c:185
void aes_decrypt_deinit(void *ctx)
Deinitialize AES decryption.
Definition: aes-internal-dec.c:153
void aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
Encrypt one AES block.
Definition: aes-internal-enc.c:111
struct crypto_ec * crypto_ec_init(int group)
Initialize elliptic curve context.
void aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
Decrypt one AES block.
Definition: aes-internal-dec.c:146
void crypto_ec_point_deinit(struct crypto_ec_point *p, int clear)
Deinitialize EC point data.
void crypto_ec_deinit(struct crypto_ec *e)
Deinitialize elliptic curve context.
void crypto_hash_update(struct crypto_hash *ctx, const u8 *data, size_t len)
Add data to hash calculation.
Definition: crypto_internal.c:121
int crypto_bignum_inverse(const struct crypto_bignum *a, const struct crypto_bignum *b, struct crypto_bignum *c)
Inverse a bignum so that a * c = 1 (mod b)
Definition: crypto_openssl.c:1029
int __must_check crypto_cipher_encrypt(struct crypto_cipher *ctx, const u8 *plain, u8 *crypt, size_t len)
Cipher encrypt.
Definition: crypto_gnutls.c:270
int crypto_bignum_add(const struct crypto_bignum *a, const struct crypto_bignum *b, struct crypto_bignum *c)
c = a + b
Definition: crypto_openssl.c:983
int crypto_hash_finish(struct crypto_hash *ctx, u8 *hash, size_t *len)
Complete hash calculation.
Definition: crypto_internal.c:147
int crypto_bignum_bits(const struct crypto_bignum *a)
Get size of a bignum in bits.
Definition: crypto_openssl.c:1102
int crypto_bignum_is_one(const struct crypto_bignum *a)
Is the given bignum one.
Definition: crypto_openssl.c:1114
struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key, size_t key_len)
Initialize hash/HMAC function.
Definition: crypto_internal.c:27
void * aes_decrypt_init(const u8 *key, size_t len)
Initialize AES for decryption.
Definition: aes-internal-dec.c:55
int crypto_ec_point_is_at_infinity(struct crypto_ec *e, const struct crypto_ec_point *p)
Check whether EC point is neutral element.
int crypto_bignum_exptmod(const struct crypto_bignum *a, const struct crypto_bignum *b, const struct crypto_bignum *c, struct crypto_bignum *d)
Modular exponentiation: d = a^b (mod c)
Definition: crypto_openssl.c:1010
int crypto_ec_point_cmp(const struct crypto_ec *e, const struct crypto_ec_point *a, const struct crypto_ec_point *b)
Compare two EC points.
void crypto_private_key_free(struct crypto_private_key *key)
Free private key.
Definition: crypto_internal-rsa.c:101
struct crypto_bignum * crypto_bignum_init_set(const u8 *buf, size_t len)
Allocate memory for bignum and set the value.
Definition: crypto_openssl.c:944
int crypto_bignum_cmp(const struct crypto_bignum *a, const struct crypto_bignum *b)
Compare two bignums.
Definition: crypto_openssl.c:1095
int crypto_bignum_mod(const struct crypto_bignum *a, const struct crypto_bignum *b, struct crypto_bignum *c)
c = a % b
Definition: crypto_openssl.c:992
int crypto_bignum_is_zero(const struct crypto_bignum *a)
Is the given bignum zero.
Definition: crypto_openssl.c:1108
struct crypto_private_key * crypto_private_key_import(const u8 *key, size_t len, const char *passwd)
Import an RSA private key.
Definition: crypto_internal-rsa.c:34
void crypto_global_deinit(void)
Deinitialize crypto wrapper.
Definition: crypto_internal.c:269
int crypto_bignum_div(const struct crypto_bignum *a, const struct crypto_bignum *b, struct crypto_bignum *c)
c = a / b
Definition: crypto_openssl.c:1056
int __must_check crypto_private_key_decrypt_pkcs1_v15(struct crypto_private_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen)
Private key decryption (PKCS #1 v1.5)
Definition: crypto_internal-rsa.c:77
void * aes_encrypt_init(const u8 *key, size_t len)
Initialize AES for encryption.
Definition: aes-internal-enc.c:94
int __must_check crypto_public_key_decrypt_pkcs1(struct crypto_public_key *key, const u8 *crypt, size_t crypt_len, u8 *plain, size_t *plain_len)
Decrypt PKCS #1 signature.
Definition: crypto_internal-rsa.c:107
int __must_check crypto_private_key_sign_pkcs1(struct crypto_private_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen)
Sign with private key (PKCS #1)
Definition: crypto_internal-rsa.c:86
void crypto_public_key_free(struct crypto_public_key *key)
Free public key.
Definition: crypto_internal-rsa.c:95
int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
MD4 hash for data vector.
Definition: crypto_gnutls.c:11
int crypto_ec_point_mul(struct crypto_ec *e, const struct crypto_ec_point *p, const struct crypto_bignum *b, struct crypto_ec_point *res)
res = b * p
const struct crypto_bignum * crypto_ec_get_prime(struct crypto_ec *e)
Get prime defining an EC group.
int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
MD5 hash for data vector.
Definition: crypto_gnutls.c:51
struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg, const u8 *iv, const u8 *key, size_t key_len)
Initialize block/stream cipher function.
Definition: crypto_gnutls.c:191
Definition: crypto_internal.c:13
int __must_check crypto_global_init(void)
Initialize crypto wrapper.
Definition: crypto_internal.c:263
int __must_check crypto_public_key_encrypt_pkcs1_v15(struct crypto_public_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen)
Public key encryption (PKCS #1 v1.5)
Definition: crypto_internal-rsa.c:68
struct crypto_ec_point * crypto_ec_point_init(struct crypto_ec *e)
Initialize data for an EC point.
int crypto_ec_point_is_on_curve(struct crypto_ec *e, const struct crypto_ec_point *p)
Check whether EC point is on curve.
int crypto_bignum_mulmod(const struct crypto_bignum *a, const struct crypto_bignum *b, const struct crypto_bignum *c, struct crypto_bignum *d)
d = a * b (mod c)
Definition: crypto_openssl.c:1075
const struct crypto_bignum * crypto_ec_get_order(struct crypto_ec *e)
Get order of an EC group.
void aes_encrypt_deinit(void *ctx)
Deinitialize AES encryption.
Definition: aes-internal-enc.c:118
Definition: crypto_libtomcrypt.c:407
int crypto_ec_point_to_bin(struct crypto_ec *e, const struct crypto_ec_point *point, u8 *x, u8 *y)
Write EC point value as binary data.
int crypto_bignum_legendre(const struct crypto_bignum *a, const struct crypto_bignum *p)
Compute the Legendre symbol (a/p)
Definition: crypto_openssl.c:1120
int crypto_bignum_to_bin(const struct crypto_bignum *a, u8 *buf, size_t buflen, size_t padlen)
Set binary buffer to unsigned bignum.
Definition: crypto_openssl.c:960
void des_encrypt(const u8 *clear, const u8 *key, u8 *cypher)
Encrypt one block with DES.
Definition: crypto_gnutls.c:29