71#define BOTAN_FFI_API_VERSION 20240408
80 #define BOTAN_FFI_EXPORT(maj, min) BOTAN_DLL
82 #if defined(__has_attribute)
83 #if __has_attribute(visibility)
84 #define BOTAN_FFI_EXPORT(maj, min) __attribute__((visibility("default")))
86 #elif defined(_MSC_VER) && !defined(BOTAN_IS_BEING_BUILT)
87 #define BOTAN_FFI_EXPORT(maj, min) __declspec(dllimport)
89 #define BOTAN_FFI_EXPORT(maj, min)
93#if !defined(BOTAN_NO_DEPRECATED_WARNINGS)
94 #if defined(__has_attribute)
95 #if __has_attribute(deprecated)
96 #define BOTAN_FFI_DEPRECATED(msg) __attribute__((deprecated(msg)))
98 #elif defined(_MSC_VER)
99 #define BOTAN_FFI_DEPRECATED(msg) __declspec(deprecated(msg))
103#if !defined(BOTAN_FFI_DEPRECATED)
104 #define BOTAN_FFI_DEPRECATED(msg)
237#define BOTAN_FFI_HEX_LOWER_CASE 1
299 const
char* rng_name,
301 int (*get_cb)(
void* context, uint8_t* out,
size_t out_len),
302 int (*add_entropy_cb)(
void* context, const uint8_t input[],
size_t length),
303 void (*destroy_cb)(
void* context));
524 size_t* out_minimum_keylength,
525 size_t* out_maximum_keylength,
526 size_t* out_keylength_modulo);
540#define BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION 1
541#define BOTAN_CIPHER_INIT_FLAG_ENCRYPT 0
542#define BOTAN_CIPHER_INIT_FLAG_DECRYPT 1
635#define BOTAN_CIPHER_UPDATE_FLAG_FINAL (1U << 0)
664 size_t* output_written,
665 const uint8_t input_bytes[],
667 size_t* input_consumed);
700 const
char* passphrase,
701 const uint8_t salt[],
733 const
char* passphrase,
734 const uint8_t salt[],
736 size_t milliseconds_to_run,
737 size_t* out_iterations_used);
760 const
char* passphrase,
761 size_t passphrase_len,
762 const uint8_t salt[],
788 const
char* passphrase,
789 size_t passphrase_len,
790 const uint8_t salt[],
802 const
char* passphrase,
803 const uint8_t salt[],
826 const uint8_t secret[],
828 const uint8_t salt[],
830 const uint8_t label[],
895 size_t* out_minimum_keylength,
896 size_t* out_maximum_keylength,
897 size_t* out_keylength_modulo);
1084 uint8_t* out,
size_t* out_len, const
char* password,
botan_rng_t rng,
size_t work_factor, uint32_t flags);
1112#define BOTAN_CHECK_KEY_EXPENSIVE_TESTS 1
1182#define BOTAN_PRIVKEY_EXPORT_FLAG_DER 0
1183#define BOTAN_PRIVKEY_EXPORT_FLAG_PEM 1
1184#define BOTAN_PRIVKEY_EXPORT_FLAG_RAW 2
1216BOTAN_FFI_EXPORT(2, 0)
1217int botan_privkey_export_encrypted(botan_privkey_t key,
1221 const char* passphrase,
1222 const char* encryption_algo,
1226* Export a private key, running PBKDF for specified amount of time
1227* @param key the private key to export
1229* Note: starting in 3.0, the output iterations count is not provided
1231BOTAN_FFI_EXPORT(2, 0)
1232int botan_privkey_export_encrypted_pbkdf_msec(botan_privkey_t key,
1236 const char* passphrase,
1237 uint32_t pbkdf_msec_runtime,
1238 size_t* pbkdf_iterations_out,
1239 const char* cipher_algo,
1240 const char* pbkdf_algo,
1246BOTAN_FFI_EXPORT(2, 0)
1247int botan_privkey_export_encrypted_pbkdf_iter(botan_privkey_t key,
1251 const char* passphrase,
1252 size_t pbkdf_iterations,
1253 const char* cipher_algo,
1254 const char* pbkdf_algo,
1263BOTAN_FFI_EXPORT(3, 0)
1264int botan_privkey_view_encrypted_der(botan_privkey_t key,
1266 const char* passphrase,
1267 const char* cipher_algo,
1268 const char* pbkdf_algo,
1269 size_t pbkdf_iterations,
1271 botan_view_bin_fn view);
1278BOTAN_FFI_EXPORT(3, 0)
1279int botan_privkey_view_encrypted_der_timed(botan_privkey_t key,
1281 const char* passphrase,
1282 const char* cipher_algo,
1283 const char* pbkdf_algo,
1284 size_t pbkdf_runtime_msec,
1286 botan_view_bin_fn view);
1294BOTAN_FFI_EXPORT(3, 0)
1295int botan_privkey_view_encrypted_pem(botan_privkey_t key,
1297 const char* passphrase,
1298 const char* cipher_algo,
1299 const char* pbkdf_algo,
1300 size_t pbkdf_iterations,
1302 botan_view_str_fn view);
1309BOTAN_FFI_EXPORT(3, 0)
1310int botan_privkey_view_encrypted_pem_timed(botan_privkey_t key,
1312 const char* passphrase,
1313 const char* cipher_algo,
1314 const char* pbkdf_algo,
1315 size_t pbkdf_runtime_msec,
1317 botan_view_str_fn view);
1319typedef struct botan_pubkey_struct* botan_pubkey_t;
1321BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load(botan_pubkey_t* key, const uint8_t bits[], size_t len);
1323BOTAN_FFI_EXPORT(2, 0) int botan_privkey_export_pubkey(botan_pubkey_t* out, botan_privkey_t in);
1325BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_export(botan_pubkey_t key, uint8_t out[], size_t* out_len, uint32_t flags);
1330BOTAN_FFI_EXPORT(3, 0) int botan_pubkey_view_der(botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1335BOTAN_FFI_EXPORT(3, 0) int botan_pubkey_view_pem(botan_pubkey_t key, botan_view_ctx ctx, botan_view_str_fn view);
1340BOTAN_FFI_EXPORT(3, 6) int botan_pubkey_view_raw(botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1342BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_algo_name(botan_pubkey_t key, char out[], size_t* out_len);
1347BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_check_key(botan_pubkey_t key, botan_rng_t rng, uint32_t flags);
1349BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_estimated_strength(botan_pubkey_t key, size_t* estimate);
1351BOTAN_FFI_EXPORT(2, 0)
1352int botan_pubkey_fingerprint(botan_pubkey_t key, const char* hash, uint8_t out[], size_t* out_len);
1357BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_destroy(botan_pubkey_t key);
1360* Get arbitrary named fields from public or private keys
1362BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_get_field(botan_mp_t output, botan_pubkey_t key, const char* field_name);
1364BOTAN_FFI_EXPORT(2, 0) int botan_privkey_get_field(botan_mp_t output, botan_privkey_t key, const char* field_name);
1367* Algorithm specific key operations: RSA
1369BOTAN_FFI_EXPORT(2, 0) int botan_privkey_load_rsa(botan_privkey_t* key, botan_mp_t p, botan_mp_t q, botan_mp_t e);
1371BOTAN_FFI_EXPORT(2, 8) int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key, const uint8_t bits[], size_t len);
1374BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_p(botan_mp_t p, botan_privkey_t rsa_key);
1376BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_q(botan_mp_t q, botan_privkey_t rsa_key);
1378BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_d(botan_mp_t d, botan_privkey_t rsa_key);
1380BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_n(botan_mp_t n, botan_privkey_t rsa_key);
1382BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_e(botan_mp_t e, botan_privkey_t rsa_key);
1384BOTAN_FFI_EXPORT(2, 8)
1385int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key, uint8_t out[], size_t* out_len, uint32_t flags);
1387BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load_rsa(botan_pubkey_t* key, botan_mp_t n, botan_mp_t e);
1390BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_rsa_get_e(botan_mp_t e, botan_pubkey_t rsa_key);
1392BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t rsa_key);
1395* Algorithm specific key operations: DSA
1397BOTAN_FFI_EXPORT(2, 0)
1398int botan_privkey_load_dsa(botan_privkey_t* key, botan_mp_t p, botan_mp_t q, botan_mp_t g, botan_mp_t x);
1400BOTAN_FFI_EXPORT(2, 0)
1401int botan_pubkey_load_dsa(botan_pubkey_t* key, botan_mp_t p, botan_mp_t q, botan_mp_t g, botan_mp_t y);
1404BOTAN_FFI_EXPORT(2, 0) int botan_privkey_dsa_get_x(botan_mp_t n, botan_privkey_t key);
1407BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_p(botan_mp_t p, botan_pubkey_t key);
1409BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_q(botan_mp_t q, botan_pubkey_t key);
1411BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_g(botan_mp_t d, botan_pubkey_t key);
1413BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_y(botan_mp_t y, botan_pubkey_t key);
1416* Loads Diffie Hellman private key
1418* @param key variable populated with key material
1419* @param p prime order of a Z_p group
1420* @param g group generator
1421* @param x private key
1423* @pre key is NULL on input
1424* @post function allocates memory and assigns to `key'
1426* @return 0 on success, a negative value on failure
1428BOTAN_FFI_EXPORT(2, 0) int botan_privkey_load_dh(botan_privkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t x);
1442BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load_dh(botan_pubkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t y);
1445* Algorithm specific key operations: ElGamal
1460BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load_elgamal(botan_pubkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t y);
1475BOTAN_FFI_EXPORT(2, 0) int botan_privkey_load_elgamal(botan_privkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t x);
1478* Algorithm specific key operations: Ed25519
1481BOTAN_FFI_EXPORT(2, 2) int botan_privkey_load_ed25519(botan_privkey_t* key, const uint8_t privkey[32]);
1483BOTAN_FFI_EXPORT(2, 2) int botan_pubkey_load_ed25519(botan_pubkey_t* key, const uint8_t pubkey[32]);
1485BOTAN_FFI_EXPORT(2, 2) int botan_privkey_ed25519_get_privkey(botan_privkey_t key, uint8_t output[64]);
1487BOTAN_FFI_EXPORT(2, 2) int botan_pubkey_ed25519_get_pubkey(botan_pubkey_t key, uint8_t pubkey[32]);
1490* Algorithm specific key operations: Ed448
1493BOTAN_FFI_EXPORT(3, 4) int botan_privkey_load_ed448(botan_privkey_t* key, const uint8_t privkey[57]);
1495BOTAN_FFI_EXPORT(3, 4) int botan_pubkey_load_ed448(botan_pubkey_t* key, const uint8_t pubkey[57]);
1497BOTAN_FFI_EXPORT(3, 4) int botan_privkey_ed448_get_privkey(botan_privkey_t key, uint8_t output[57]);
1499BOTAN_FFI_EXPORT(3, 4) int botan_pubkey_ed448_get_pubkey(botan_pubkey_t key, uint8_t pubkey[57]);
1502* Algorithm specific key operations: X25519
1505BOTAN_FFI_EXPORT(2, 8) int botan_privkey_load_x25519(botan_privkey_t* key, const uint8_t privkey[32]);
1507BOTAN_FFI_EXPORT(2, 8) int botan_pubkey_load_x25519(botan_pubkey_t* key, const uint8_t pubkey[32]);
1509BOTAN_FFI_EXPORT(2, 8) int botan_privkey_x25519_get_privkey(botan_privkey_t key, uint8_t output[32]);
1511BOTAN_FFI_EXPORT(2, 8) int botan_pubkey_x25519_get_pubkey(botan_pubkey_t key, uint8_t pubkey[32]);
1514* Algorithm specific key operations: X448
1517BOTAN_FFI_EXPORT(3, 4) int botan_privkey_load_x448(botan_privkey_t* key, const uint8_t privkey[56]);
1519BOTAN_FFI_EXPORT(3, 4) int botan_pubkey_load_x448(botan_pubkey_t* key, const uint8_t pubkey[56]);
1521BOTAN_FFI_EXPORT(3, 4) int botan_privkey_x448_get_privkey(botan_privkey_t key, uint8_t output[56]);
1523BOTAN_FFI_EXPORT(3, 4) int botan_pubkey_x448_get_pubkey(botan_pubkey_t key, uint8_t pubkey[56]);
1526* Algorithm specific key operations: ML-DSA
1529BOTAN_FFI_EXPORT(3, 6)
1530int botan_privkey_load_ml_dsa(botan_privkey_t* key, const uint8_t privkey[], size_t key_len, const char* mldsa_mode);
1532BOTAN_FFI_EXPORT(3, 6)
1533int botan_pubkey_load_ml_dsa(botan_pubkey_t* key, const uint8_t pubkey[], size_t key_len, const char* mldsa_mode);
1536* Algorithm specific key operations: Kyber
1539BOTAN_FFI_EXPORT(3, 1) int botan_privkey_load_kyber(botan_privkey_t* key, const uint8_t privkey[], size_t key_len);
1541BOTAN_FFI_EXPORT(3, 1) int botan_pubkey_load_kyber(botan_pubkey_t* key, const uint8_t pubkey[], size_t key_len);
1544BOTAN_FFI_EXPORT(3, 1)
1545int botan_privkey_view_kyber_raw_key(botan_privkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1548BOTAN_FFI_EXPORT(3, 1)
1549int botan_pubkey_view_kyber_raw_key(botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1555BOTAN_FFI_EXPORT(3, 6)
1556int botan_privkey_load_frodokem(botan_privkey_t* key, const uint8_t privkey[], size_t key_len, const char* frodo_mode);
1558BOTAN_FFI_EXPORT(3, 6)
1559int botan_pubkey_load_frodokem(botan_pubkey_t* key, const uint8_t pubkey[], size_t key_len, const char* frodo_mode);
1565BOTAN_FFI_EXPORT(3, 6)
1566int botan_privkey_load_classic_mceliece(botan_privkey_t* key,
1567 const uint8_t privkey[],
1569 const char* cmce_mode);
1571BOTAN_FFI_EXPORT(3, 6)
1572int botan_pubkey_load_classic_mceliece(botan_pubkey_t* key,
1573 const uint8_t pubkey[],
1575 const char* cmce_mode);
1578* Algorithm specific key operations: ML-KEM
1581BOTAN_FFI_EXPORT(3, 6)
1582int botan_privkey_load_ml_kem(botan_privkey_t* key, const uint8_t privkey[], size_t key_len, const char* mlkem_mode);
1584BOTAN_FFI_EXPORT(3, 6)
1585int botan_pubkey_load_ml_kem(botan_pubkey_t* key, const uint8_t pubkey[], size_t key_len, const char* mlkem_mode);
1588* Algorithm specific key operations: SLH-DSA
1591BOTAN_FFI_EXPORT(3, 6)
1592int botan_privkey_load_slh_dsa(botan_privkey_t* key, const uint8_t privkey[], size_t key_len, const char* slhdsa_mode);
1594BOTAN_FFI_EXPORT(3, 6)
1595int botan_pubkey_load_slh_dsa(botan_pubkey_t* key, const uint8_t pubkey[], size_t key_len, const char* slhdsa_mode);
1598* Algorithm specific key operations: ECDSA and ECDH
1600BOTAN_FFI_EXPORT(3, 2)
1601int botan_pubkey_ecc_key_used_explicit_encoding(botan_pubkey_t key);
1603BOTAN_FFI_EXPORT(2, 2)
1604int botan_privkey_load_ecdsa(botan_privkey_t* key, botan_mp_t scalar, const char* curve_name);
1606BOTAN_FFI_EXPORT(2, 2)
1607int botan_pubkey_load_ecdsa(botan_pubkey_t* key, botan_mp_t public_x, botan_mp_t public_y, const char* curve_name);
1609BOTAN_FFI_EXPORT(2, 2)
1610int botan_pubkey_load_ecdh(botan_pubkey_t* key, botan_mp_t public_x, botan_mp_t public_y, const char* curve_name);
1612BOTAN_FFI_EXPORT(2, 2)
1613int botan_privkey_load_ecdh(botan_privkey_t* key, botan_mp_t scalar, const char* curve_name);
1615BOTAN_FFI_EXPORT(2, 2)
1616int botan_pubkey_load_sm2(botan_pubkey_t* key, botan_mp_t public_x, botan_mp_t public_y, const char* curve_name);
1618BOTAN_FFI_EXPORT(2, 2)
1619int botan_privkey_load_sm2(botan_privkey_t* key, botan_mp_t scalar, const char* curve_name);
1622BOTAN_FFI_EXPORT(2, 2)
1623int botan_pubkey_load_sm2_enc(botan_pubkey_t* key, botan_mp_t public_x, botan_mp_t public_y, const char* curve_name);
1626BOTAN_FFI_EXPORT(2, 2)
1627int botan_privkey_load_sm2_enc(botan_privkey_t* key, botan_mp_t scalar, const char* curve_name);
1629BOTAN_FFI_EXPORT(2, 3)
1630int botan_pubkey_sm2_compute_za(
1631 uint8_t out[], size_t* out_len, const char* ident, const char* hash_algo, botan_pubkey_t key);
1636BOTAN_FFI_EXPORT(3, 0)
1637int botan_pubkey_view_ec_public_point(botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1640* Public Key Encryption
1642typedef struct botan_pk_op_encrypt_struct* botan_pk_op_encrypt_t;
1644BOTAN_FFI_EXPORT(2, 0)
1645int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op, botan_pubkey_t key, const char* padding, uint32_t flags);
1650BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op);
1652BOTAN_FFI_EXPORT(2, 8)
1653int botan_pk_op_encrypt_output_length(botan_pk_op_encrypt_t op, size_t ptext_len, size_t* ctext_len);
1655BOTAN_FFI_EXPORT(2, 0)
1656int botan_pk_op_encrypt(botan_pk_op_encrypt_t op,
1660 const uint8_t plaintext[],
1661 size_t plaintext_len);
1664* Public Key Decryption
1666typedef struct botan_pk_op_decrypt_struct* botan_pk_op_decrypt_t;
1668BOTAN_FFI_EXPORT(2, 0)
1669int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op, botan_privkey_t key, const char* padding, uint32_t flags);
1674BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op);
1676BOTAN_FFI_EXPORT(2, 8)
1677int botan_pk_op_decrypt_output_length(botan_pk_op_decrypt_t op, size_t ctext_len, size_t* ptext_len);
1679BOTAN_FFI_EXPORT(2, 0)
1680int botan_pk_op_decrypt(
1681 botan_pk_op_decrypt_t op, uint8_t out[], size_t* out_len, const uint8_t ciphertext[], size_t ciphertext_len);
1684* Signature Generation
1687#define BOTAN_PUBKEY_DER_FORMAT_SIGNATURE 1
1689typedef struct botan_pk_op_sign_struct* botan_pk_op_sign_t;
1691BOTAN_FFI_EXPORT(2, 0)
1692int botan_pk_op_sign_create(botan_pk_op_sign_t* op, botan_privkey_t key, const char* hash_and_padding, uint32_t flags);
1697BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_sign_destroy(botan_pk_op_sign_t op);
1699BOTAN_FFI_EXPORT(2, 8) int botan_pk_op_sign_output_length(botan_pk_op_sign_t op, size_t* olen);
1701BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_sign_update(botan_pk_op_sign_t op, const uint8_t in[], size_t in_len);
1703BOTAN_FFI_EXPORT(2, 0)
1704int botan_pk_op_sign_finish(botan_pk_op_sign_t op, botan_rng_t rng, uint8_t sig[], size_t* sig_len);
1707* Signature Verification
1709typedef struct botan_pk_op_verify_struct* botan_pk_op_verify_t;
1711BOTAN_FFI_EXPORT(2, 0)
1712int botan_pk_op_verify_create(botan_pk_op_verify_t* op,
1714 const char* hash_and_padding,
1720BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_verify_destroy(botan_pk_op_verify_t op);
1722BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_verify_update(botan_pk_op_verify_t op, const uint8_t in[], size_t in_len);
1723BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_verify_finish(botan_pk_op_verify_t op, const uint8_t sig[], size_t sig_len);
1728typedef struct botan_pk_op_ka_struct* botan_pk_op_ka_t;
1730BOTAN_FFI_EXPORT(2, 0)
1731int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op, botan_privkey_t key, const char* kdf, uint32_t flags);
1736BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_key_agreement_destroy(botan_pk_op_ka_t op);
1738BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_key_agreement_export_public(botan_privkey_t key, uint8_t out[], size_t* out_len);
1740BOTAN_FFI_EXPORT(3, 0)
1741int botan_pk_op_key_agreement_view_public(botan_privkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1743BOTAN_FFI_EXPORT(2, 8) int botan_pk_op_key_agreement_size(botan_pk_op_ka_t op, size_t* out_len);
1745BOTAN_FFI_EXPORT(2, 0)
1746int botan_pk_op_key_agreement(botan_pk_op_ka_t op,
1749 const uint8_t other_key[],
1750 size_t other_key_len,
1751 const uint8_t salt[],
1757typedef struct botan_pk_op_kem_encrypt_struct* botan_pk_op_kem_encrypt_t;
1759BOTAN_FFI_EXPORT(3, 0)
1760int botan_pk_op_kem_encrypt_create(botan_pk_op_kem_encrypt_t* op, botan_pubkey_t key, const char* kdf);
1765BOTAN_FFI_EXPORT(3, 0) int botan_pk_op_kem_encrypt_destroy(botan_pk_op_kem_encrypt_t op);
1767BOTAN_FFI_EXPORT(3, 0)
1768int botan_pk_op_kem_encrypt_shared_key_length(botan_pk_op_kem_encrypt_t op,
1769 size_t desired_shared_key_length,
1770 size_t* output_shared_key_length);
1772BOTAN_FFI_EXPORT(3, 0)
1773int botan_pk_op_kem_encrypt_encapsulated_key_length(botan_pk_op_kem_encrypt_t op,
1774 size_t* output_encapsulated_key_length);
1776BOTAN_FFI_EXPORT(3, 0)
1777int botan_pk_op_kem_encrypt_create_shared_key(botan_pk_op_kem_encrypt_t op,
1779 const uint8_t salt[],
1781 size_t desired_shared_key_len,
1782 uint8_t shared_key[],
1783 size_t* shared_key_len,
1784 uint8_t encapsulated_key[],
1785 size_t* encapsulated_key_len);
1787typedef struct botan_pk_op_kem_decrypt_struct* botan_pk_op_kem_decrypt_t;
1789BOTAN_FFI_EXPORT(3, 0)
1790int botan_pk_op_kem_decrypt_create(botan_pk_op_kem_decrypt_t* op, botan_privkey_t key, const char* kdf);
1795BOTAN_FFI_EXPORT(3, 0) int botan_pk_op_kem_decrypt_destroy(botan_pk_op_kem_decrypt_t op);
1797BOTAN_FFI_EXPORT(3, 0)
1798int botan_pk_op_kem_decrypt_shared_key_length(botan_pk_op_kem_decrypt_t op,
1799 size_t desired_shared_key_length,
1800 size_t* output_shared_key_length);
1802BOTAN_FFI_EXPORT(3, 0)
1803int botan_pk_op_kem_decrypt_shared_key(botan_pk_op_kem_decrypt_t op,
1804 const uint8_t salt[],
1806 const uint8_t encapsulated_key[],
1807 size_t encapsulated_key_len,
1808 size_t desired_shared_key_len,
1809 uint8_t shared_key[],
1810 size_t* shared_key_len);
1816BOTAN_FFI_EXPORT(2, 0) int botan_pkcs_hash_id(const char* hash_name, uint8_t pkcs_id[], size_t* pkcs_id_len);
1819* Always returns BOTAN_FFI_ERROR_NOT_IMPLEMENTED
1821BOTAN_FFI_DEPRECATED("No longer implemented
")
1822BOTAN_FFI_EXPORT(2, 0)
1823int botan_mceies_encrypt(botan_pubkey_t mce_key,
1834* Always returns BOTAN_FFI_ERROR_NOT_IMPLEMENTED
1836BOTAN_FFI_DEPRECATED("No longer implemented
")
1837BOTAN_FFI_EXPORT(2, 0)
1838int botan_mceies_decrypt(botan_privkey_t mce_key,
1849**************************/
1851typedef struct botan_x509_cert_struct* botan_x509_cert_t;
1853BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert[], size_t cert_len);
1854BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* filename);
1859BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_destroy(botan_x509_cert_t cert);
1861BOTAN_FFI_EXPORT(2, 8) int botan_x509_cert_dup(botan_x509_cert_t* new_cert, botan_x509_cert_t cert);
1863/* Prefer botan_x509_cert_not_before and botan_x509_cert_not_after */
1864BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t* out_len);
1865BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t* out_len);
1867BOTAN_FFI_EXPORT(2, 8) int botan_x509_cert_not_before(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1868BOTAN_FFI_EXPORT(2, 8) int botan_x509_cert_not_after(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1870BOTAN_FFI_EXPORT(2, 0)
1871int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char* hash, uint8_t out[], size_t* out_len);
1873BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1874BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1875BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1877BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1879BOTAN_FFI_EXPORT(3, 0)
1880int botan_x509_cert_view_public_key_bits(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_bin_fn view);
1882BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t* key);
1884BOTAN_FFI_EXPORT(2, 0)
1885int botan_x509_cert_get_issuer_dn(
1886 botan_x509_cert_t cert, const char* key, size_t index, uint8_t out[], size_t* out_len);
1888BOTAN_FFI_EXPORT(2, 0)
1889int botan_x509_cert_get_subject_dn(
1890 botan_x509_cert_t cert, const char* key, size_t index, uint8_t out[], size_t* out_len);
1892BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t* out_len);
1894BOTAN_FFI_EXPORT(3, 0)
1895int botan_x509_cert_view_as_string(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_str_fn view);
1897/* Must match values of Key_Constraints in key_constraints.h */
1898enum botan_x509_cert_key_constraints {
1900 DIGITAL_SIGNATURE = 32768,
1901 NON_REPUDIATION = 16384,
1902 KEY_ENCIPHERMENT = 8192,
1903 DATA_ENCIPHERMENT = 4096,
1904 KEY_AGREEMENT = 2048,
1905 KEY_CERT_SIGN = 1024,
1907 ENCIPHER_ONLY = 256,
1911BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage);
1917BOTAN_FFI_EXPORT(2, 5) int botan_x509_cert_hostname_match(botan_x509_cert_t cert, const char* hostname);
1927BOTAN_FFI_EXPORT(2, 8)
1928int botan_x509_cert_verify(int* validation_result,
1929 botan_x509_cert_t cert,
1930 const botan_x509_cert_t* intermediates,
1931 size_t intermediates_len,
1932 const botan_x509_cert_t* trusted,
1934 const char* trusted_path,
1935 size_t required_strength,
1936 const char* hostname,
1937 uint64_t reference_time);
1943BOTAN_FFI_EXPORT(2, 8) const char* botan_x509_cert_validation_status(int code);
1947**************************/
1949typedef struct botan_x509_crl_struct* botan_x509_crl_t;
1951BOTAN_FFI_EXPORT(2, 13) int botan_x509_crl_load_file(botan_x509_crl_t* crl_obj, const char* crl_path);
1952BOTAN_FFI_EXPORT(2, 13)
1953int botan_x509_crl_load(botan_x509_crl_t* crl_obj, const uint8_t crl_bits[], size_t crl_bits_len);
1955BOTAN_FFI_EXPORT(2, 13) int botan_x509_crl_destroy(botan_x509_crl_t crl);
1961BOTAN_FFI_EXPORT(2, 13) int botan_x509_is_revoked(botan_x509_crl_t crl, botan_x509_cert_t cert);
1967BOTAN_FFI_EXPORT(2, 13)
1968int botan_x509_cert_verify_with_crl(int* validation_result,
1969 botan_x509_cert_t cert,
1970 const botan_x509_cert_t* intermediates,
1971 size_t intermediates_len,
1972 const botan_x509_cert_t* trusted,
1974 const botan_x509_crl_t* crls,
1976 const char* trusted_path,
1977 size_t required_strength,
1978 const char* hostname,
1979 uint64_t reference_time);
1985BOTAN_FFI_EXPORT(2, 2)
1986int botan_key_wrap3394(const uint8_t key[],
1988 const uint8_t kek[],
1990 uint8_t wrapped_key[],
1991 size_t* wrapped_key_len);
1994BOTAN_FFI_EXPORT(2, 2)
1995int botan_key_unwrap3394(const uint8_t wrapped_key[],
1996 size_t wrapped_key_len,
1997 const uint8_t kek[],
2002BOTAN_FFI_EXPORT(3, 0)
2003int botan_nist_kw_enc(const char* cipher_algo,
2005 const uint8_t key[],
2007 const uint8_t kek[],
2009 uint8_t wrapped_key[],
2010 size_t* wrapped_key_len);
2012BOTAN_FFI_EXPORT(3, 0)
2013int botan_nist_kw_dec(const char* cipher_algo,
2015 const uint8_t wrapped_key[],
2016 size_t wrapped_key_len,
2017 const uint8_t kek[],
2026typedef struct botan_hotp_struct* botan_hotp_t;
2031BOTAN_FFI_EXPORT(2, 8)
2032int botan_hotp_init(botan_hotp_t* hotp, const uint8_t key[], size_t key_len, const char* hash_algo, size_t digits);
2038BOTAN_FFI_EXPORT(2, 8)
2039int botan_hotp_destroy(botan_hotp_t hotp);
2044BOTAN_FFI_EXPORT(2, 8)
2045int botan_hotp_generate(botan_hotp_t hotp, uint32_t* hotp_code, uint64_t hotp_counter);
2050BOTAN_FFI_EXPORT(2, 8)
2051int botan_hotp_check(
2052 botan_hotp_t hotp, uint64_t* next_hotp_counter, uint32_t hotp_code, uint64_t hotp_counter, size_t resync_range);
2058typedef struct botan_totp_struct* botan_totp_t;
2063BOTAN_FFI_EXPORT(2, 8)
2065 botan_totp_t* totp, const uint8_t key[], size_t key_len, const char* hash_algo, size_t digits, size_t time_step);
2071BOTAN_FFI_EXPORT(2, 8)
2072int botan_totp_destroy(botan_totp_t totp);
2080BOTAN_FFI_EXPORT(2, 8)
2081int botan_totp_generate(botan_totp_t totp, uint32_t* totp_code, uint64_t timestamp);
2091BOTAN_FFI_EXPORT(2, 8)
2092int botan_totp_check(botan_totp_t totp, uint32_t totp_code, uint64_t timestamp, size_t acceptable_clock_drift);
2098typedef struct botan_fpe_struct* botan_fpe_t;
2100#define BOTAN_FPE_FLAG_FE1_COMPAT_MODE 1
2102BOTAN_FFI_EXPORT(2, 8)
2103int botan_fpe_fe1_init(
2104 botan_fpe_t* fpe, botan_mp_t n, const uint8_t key[], size_t key_len, size_t rounds, uint32_t flags);
2109BOTAN_FFI_EXPORT(2, 8)
2110int botan_fpe_destroy(botan_fpe_t fpe);
2112BOTAN_FFI_EXPORT(2, 8)
2113int botan_fpe_encrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
2115BOTAN_FFI_EXPORT(2, 8)
2116int botan_fpe_decrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
2121typedef struct botan_srp6_server_session_struct* botan_srp6_server_session_t;
2127BOTAN_FFI_EXPORT(3, 0)
2128int botan_srp6_server_session_init(botan_srp6_server_session_t* srp6);
2135BOTAN_FFI_EXPORT(3, 0)
2136int botan_srp6_server_session_destroy(botan_srp6_server_session_t srp6);
2150BOTAN_FFI_EXPORT(3, 0)
2151int botan_srp6_server_session_step1(botan_srp6_server_session_t srp6,
2152 const uint8_t verifier[],
2153 size_t verifier_len,
2154 const char* group_id,
2155 const char* hash_id,
2156 botan_rng_t rng_obj,
2169BOTAN_FFI_EXPORT(3, 0)
2170int botan_srp6_server_session_step2(
2171 botan_srp6_server_session_t srp6, const uint8_t A[], size_t A_len, uint8_t key[], size_t* key_len);
2185BOTAN_FFI_EXPORT(3, 0)
2186int botan_srp6_generate_verifier(const char* identifier,
2187 const char* password,
2188 const uint8_t salt[],
2190 const char* group_id,
2191 const char* hash_id,
2193 size_t* verifier_len);
2212BOTAN_FFI_EXPORT(3, 0)
2213int botan_srp6_client_agree(const char* username,
2214 const char* password,
2215 const char* group_id,
2216 const char* hash_id,
2217 const uint8_t salt[],
2221 botan_rng_t rng_obj,
2230BOTAN_FFI_EXPORT(3, 0)
2231int botan_srp6_group_size(const char* group_id, size_t* group_p_bytes);
2251BOTAN_FFI_EXPORT(3, 0)
2252int botan_zfec_encode(size_t K, size_t N, const uint8_t* input, size_t size, uint8_t** outputs);
2272BOTAN_FFI_EXPORT(3, 0)
2273int botan_zfec_decode(
2274 size_t K, size_t N, const size_t* indexes, uint8_t* const* inputs, size_t shareSize, uint8_t** outputs);
2279typedef struct botan_tpm2_ctx_struct* botan_tpm2_ctx_t;
2284typedef struct botan_tpm2_session_struct* botan_tpm2_session_t;
2289typedef struct botan_tpm2_crypto_backend_state_struct* botan_tpm2_crypto_backend_state_t;
2297BOTAN_FFI_EXPORT(3, 6)
2298int botan_tpm2_supports_crypto_backend();
2306BOTAN_FFI_EXPORT(3, 6) int botan_tpm2_ctx_init(botan_tpm2_ctx_t* ctx_out, const char* tcti_nameconf);
2315BOTAN_FFI_EXPORT(3, 6)
2316int botan_tpm2_ctx_init_ex(botan_tpm2_ctx_t* ctx_out, const char* tcti_name, const char* tcti_conf);
2326BOTAN_FFI_EXPORT(3, 7)
2327int botan_tpm2_ctx_from_esys(botan_tpm2_ctx_t* ctx_out, struct ESYS_CONTEXT* esys_ctx);
2338BOTAN_FFI_EXPORT(3, 6)
2339int botan_tpm2_ctx_enable_crypto_backend(botan_tpm2_ctx_t ctx, botan_rng_t rng);
2346BOTAN_FFI_EXPORT(3, 6) int botan_tpm2_ctx_destroy(botan_tpm2_ctx_t ctx);
2359BOTAN_FFI_EXPORT(3, 7)
2360int botan_tpm2_enable_crypto_backend(botan_tpm2_crypto_backend_state_t* cbs_out,
2361 struct ESYS_CONTEXT* esys_ctx,
2372BOTAN_FFI_EXPORT(3, 7) int botan_tpm2_crypto_backend_state_destroy(botan_tpm2_crypto_backend_state_t cbs);
2382BOTAN_FFI_EXPORT(3, 6)
2383int botan_tpm2_rng_init(botan_rng_t* rng_out,
2384 botan_tpm2_ctx_t ctx,
2385 botan_tpm2_session_t s1,
2386 botan_tpm2_session_t s2,
2387 botan_tpm2_session_t s3);
2394BOTAN_FFI_EXPORT(3, 6)
2395int botan_tpm2_unauthenticated_session_init(botan_tpm2_session_t* session_out, botan_tpm2_ctx_t ctx);
2401BOTAN_FFI_EXPORT(3, 6)
2402int botan_tpm2_session_destroy(botan_tpm2_session_t session);
int botan_mp_lshift(botan_mp_t out, botan_mp_t in, size_t shift)
int botan_block_cipher_get_keyspec(botan_block_cipher_t cipher, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo)
int botan_block_cipher_init(botan_block_cipher_t *bc, const char *cipher_name)
int botan_mp_is_prime(botan_mp_t n, botan_rng_t rng, size_t test_prob)
int botan_rng_reseed_from_rng(botan_rng_t rng, botan_rng_t source_rng, size_t bits)
int botan_mp_div(botan_mp_t quotient, botan_mp_t remainder, botan_mp_t x, botan_mp_t y)
uint32_t botan_version_minor(void)
int botan_mp_set_from_int(botan_mp_t mp, int initial_value)
int botan_mp_to_bin(botan_mp_t mp, uint8_t vec[])
int botan_bcrypt_generate(uint8_t *out, size_t *out_len, const char *password, botan_rng_t rng, size_t work_factor, uint32_t flags)
int botan_privkey_check_key(botan_privkey_t key, botan_rng_t rng, uint32_t flags)
int botan_base64_encode(const uint8_t *x, size_t len, char *out, size_t *out_len)
int botan_privkey_create_elgamal(botan_privkey_t *key, botan_rng_t rng, size_t pbits, size_t qbits)
int botan_mp_rand_range(botan_mp_t rand_out, botan_rng_t rng, botan_mp_t lower_bound, botan_mp_t upper_bound)
int botan_hash_update(botan_hash_t hash, const uint8_t *in, size_t in_len)
int botan_mp_rshift(botan_mp_t out, botan_mp_t in, size_t shift)
int botan_nist_kw_enc(const char *cipher_algo, int padded, const uint8_t key[], size_t key_len, const uint8_t kek[], size_t kek_len, uint8_t wrapped_key[], size_t *wrapped_key_len)
int botan_privkey_create_rsa(botan_privkey_t *key, botan_rng_t rng, size_t n_bits)
uint32_t botan_version_datestamp(void)
uint32_t botan_version_patch(void)
int botan_privkey_create_ecdsa(botan_privkey_t *key, botan_rng_t rng, const char *params)
int botan_mp_set_from_radix_str(botan_mp_t dest, const char *str, size_t radix)
int botan_rng_add_entropy(botan_rng_t rng, const uint8_t *entropy, size_t entropy_len)
int botan_cipher_start(botan_cipher_t cipher, const uint8_t *nonce, size_t nonce_len)
int botan_mp_add(botan_mp_t result, botan_mp_t x, botan_mp_t y)
int botan_mp_powmod(botan_mp_t out, botan_mp_t base, botan_mp_t exponent, botan_mp_t modulus)
uint32_t botan_version_major(void)
int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl)
int botan_mac_init(botan_mac_t *mac, const char *mac_name, uint32_t flags)
int botan_mp_to_uint32(botan_mp_t mp, uint32_t *val)
int botan_privkey_create_dh(botan_privkey_t *key, botan_rng_t rng, const char *param)
int botan_hash_name(botan_hash_t hash, char *name, size_t *name_len)
int botan_cipher_get_tag_length(botan_cipher_t cipher, size_t *tag_size)
int botan_privkey_get_field(botan_mp_t output, botan_privkey_t key, const char *field_name)
int botan_rng_init_custom(botan_rng_t *rng_out, const char *rng_name, void *context, int(*get_cb)(void *context, uint8_t *out, size_t out_len), int(*add_entropy_cb)(void *context, const uint8_t input[], size_t length), void(*destroy_cb)(void *context))
#define BOTAN_FFI_EXPORT(maj, min)
int botan_pwdhash_timed(const char *algo, uint32_t msec, size_t *param1, size_t *param2, size_t *param3, uint8_t out[], size_t out_len, const char *passphrase, size_t passphrase_len, const uint8_t salt[], size_t salt_len)
int botan_rng_reseed(botan_rng_t rng, size_t bits)
int botan_mp_init(botan_mp_t *mp)
int botan_same_mem(const uint8_t *x, const uint8_t *y, size_t len)
int botan_privkey_load(botan_privkey_t *key, botan_rng_t rng, const uint8_t bits[], size_t len, const char *password)
struct botan_mac_struct * botan_mac_t
int botan_base64_decode(const char *base64_str, size_t in_len, uint8_t *out, size_t *out_len)
int botan_mac_destroy(botan_mac_t mac)
int botan_mp_is_odd(botan_mp_t mp)
int botan_cipher_requires_entire_message(botan_cipher_t cipher)
struct botan_privkey_struct * botan_privkey_t
int botan_cipher_output_length(botan_cipher_t cipher, size_t in_len, size_t *out_len)
int botan_cipher_reset(botan_cipher_t cipher)
int botan_cipher_init(botan_cipher_t *cipher, const char *name, uint32_t flags)
int botan_block_cipher_clear(botan_block_cipher_t bc)
int botan_privkey_export(botan_privkey_t key, uint8_t out[], size_t *out_len, uint32_t flags)
int botan_hash_destroy(botan_hash_t hash)
int botan_mac_set_nonce(botan_mac_t mac, const uint8_t *nonce, size_t nonce_len)
int botan_block_cipher_block_size(botan_block_cipher_t bc)
int botan_cipher_destroy(botan_cipher_t cipher)
#define BOTAN_FFI_DEPRECATED(msg)
int botan_mp_num_bytes(botan_mp_t n, size_t *bytes)
int botan_cipher_name(botan_cipher_t cipher, char *name, size_t *name_len)
int botan_cipher_set_associated_data(botan_cipher_t cipher, const uint8_t *ad, size_t ad_len)
int botan_cipher_get_keyspec(botan_cipher_t, size_t *min_keylen, size_t *max_keylen, size_t *mod_keylen)
int botan_privkey_destroy(botan_privkey_t key)
int botan_mp_from_bin(botan_mp_t mp, const uint8_t vec[], size_t vec_len)
int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
int botan_hash_clear(botan_hash_t hash)
int botan_mp_add_u32(botan_mp_t result, botan_mp_t x, uint32_t y)
int botan_mp_to_hex(botan_mp_t mp, char *out)
int botan_privkey_view_der(botan_privkey_t key, botan_view_ctx ctx, botan_view_bin_fn view)
int botan_mp_swap(botan_mp_t x, botan_mp_t y)
int botan_mp_destroy(botan_mp_t mp)
uint32_t botan_ffi_api_version(void)
int botan_mp_mod_mul(botan_mp_t result, botan_mp_t x, botan_mp_t y, botan_mp_t mod)
int botan_privkey_view_raw(botan_privkey_t key, botan_view_ctx ctx, botan_view_bin_fn view)
int botan_hash_output_length(botan_hash_t hash, size_t *output_length)
int botan_mp_rand_bits(botan_mp_t rand_out, botan_rng_t rng, size_t bits)
int botan_cipher_set_key(botan_cipher_t cipher, const uint8_t *key, size_t key_len)
int botan_mp_equal(botan_mp_t x, botan_mp_t y)
int botan_cipher_query_keylen(botan_cipher_t, size_t *out_minimum_keylength, size_t *out_maximum_keylength)
int botan_mp_set_from_str(botan_mp_t dest, const char *str)
int botan_mp_flip_sign(botan_mp_t mp)
int botan_scrypt(uint8_t out[], size_t out_len, const char *passphrase, const uint8_t salt[], size_t salt_len, size_t N, size_t r, size_t p)
int botan_cipher_get_ideal_update_granularity(botan_cipher_t cipher, size_t *ug)
int botan_mp_clear_bit(botan_mp_t n, size_t bit)
int botan_mp_is_zero(botan_mp_t mp)
int botan_mp_mod_inverse(botan_mp_t out, botan_mp_t in, botan_mp_t modulus)
int botan_mp_cmp(int *result, botan_mp_t x, botan_mp_t y)
int botan_pbkdf(const char *pbkdf_algo, uint8_t out[], size_t out_len, const char *passphrase, const uint8_t salt[], size_t salt_len, size_t iterations)
int botan_mp_gcd(botan_mp_t out, botan_mp_t x, botan_mp_t y)
struct botan_block_cipher_struct * botan_block_cipher_t
int botan_system_rng_get(uint8_t *out, size_t out_len)
const char * botan_version_string(void)
int botan_hex_encode(const uint8_t *x, size_t len, char *out, uint32_t flags)
int botan_mp_clear(botan_mp_t mp)
int botan_cipher_is_authenticated(botan_cipher_t cipher)
int botan_mp_get_bit(botan_mp_t n, size_t bit)
int botan_privkey_load_sm2(botan_privkey_t *key, botan_mp_t scalar, const char *curve_name)
int botan_mac_final(botan_mac_t mac, uint8_t out[])
int botan_block_cipher_name(botan_block_cipher_t cipher, char *name, size_t *name_len)
int botan_rng_get(botan_rng_t rng, uint8_t *out, size_t out_len)
int(* botan_view_bin_fn)(botan_view_ctx view_ctx, const uint8_t *data, size_t len)
int botan_mp_sub_u32(botan_mp_t result, botan_mp_t x, uint32_t y)
int botan_scrub_mem(void *mem, size_t bytes)
int botan_mp_num_bits(botan_mp_t n, size_t *bits)
int botan_privkey_create(botan_privkey_t *key, const char *algo_name, const char *algo_params, botan_rng_t rng)
int botan_mac_update(botan_mac_t mac, const uint8_t *buf, size_t len)
int botan_privkey_create_mceliece(botan_privkey_t *key, botan_rng_t rng, size_t n, size_t t)
int botan_mp_mul(botan_mp_t result, botan_mp_t x, botan_mp_t y)
int botan_privkey_algo_name(botan_privkey_t key, char out[], size_t *out_len)
int botan_hash_block_size(botan_hash_t hash, size_t *block_size)
int botan_pubkey_view_raw(botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view)
int botan_hash_copy_state(botan_hash_t *dest, botan_hash_t source)
int botan_pubkey_get_field(botan_mp_t output, botan_pubkey_t key, const char *field_name)
int botan_privkey_create_dsa(botan_privkey_t *key, botan_rng_t rng, size_t pbits, size_t qbits)
int botan_pubkey_load_sm2(botan_pubkey_t *key, botan_mp_t public_x, botan_mp_t public_y, const char *curve_name)
struct botan_mp_struct * botan_mp_t
struct botan_rng_struct * botan_rng_t
int botan_block_cipher_destroy(botan_block_cipher_t bc)
@ BOTAN_FFI_ERROR_TPM_ERROR
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
@ BOTAN_FFI_ERROR_INVALID_KEY_LENGTH
@ BOTAN_FFI_ERROR_KEY_NOT_SET
@ BOTAN_FFI_ERROR_TLS_ERROR
@ BOTAN_FFI_ERROR_EXCEPTION_THROWN
@ BOTAN_FFI_ERROR_OUT_OF_MEMORY
@ BOTAN_FFI_ERROR_INTERNAL_ERROR
@ BOTAN_FFI_INVALID_VERIFIER
@ BOTAN_FFI_ERROR_INVALID_OBJECT
@ BOTAN_FFI_ERROR_UNKNOWN_ERROR
@ BOTAN_FFI_ERROR_HTTP_ERROR
@ BOTAN_FFI_ERROR_BAD_FLAG
@ BOTAN_FFI_ERROR_INVALID_INPUT
@ BOTAN_FFI_ERROR_STRING_CONVERSION_ERROR
@ BOTAN_FFI_ERROR_NULL_POINTER
@ BOTAN_FFI_ERROR_SYSTEM_ERROR
@ BOTAN_FFI_ERROR_ROUGHTIME_ERROR
@ BOTAN_FFI_ERROR_INVALID_OBJECT_STATE
@ BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE
@ BOTAN_FFI_ERROR_BAD_MAC
@ BOTAN_FFI_ERROR_BAD_PARAMETER
int botan_pwdhash(const char *algo, size_t param1, size_t param2, size_t param3, uint8_t out[], size_t out_len, const char *passphrase, size_t passphrase_len, const uint8_t salt[], size_t salt_len)
int botan_mac_name(botan_mac_t mac, char *name, size_t *name_len)
int botan_cipher_clear(botan_cipher_t hash)
int botan_mp_is_even(botan_mp_t mp)
int botan_rng_destroy(botan_rng_t rng)
int botan_ffi_supports_api(uint32_t api_version)
const char * botan_error_description(int err)
int botan_hash_final(botan_hash_t hash, uint8_t out[])
const char * botan_error_last_exception_message(void)
int botan_hash_init(botan_hash_t *hash, const char *hash_name, uint32_t flags)
int botan_mac_get_keyspec(botan_mac_t mac, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo)
struct botan_cipher_struct * botan_cipher_t
int botan_cipher_update(botan_cipher_t cipher, uint32_t flags, uint8_t output[], size_t output_size, size_t *output_written, const uint8_t input_bytes[], size_t input_size, size_t *input_consumed)
Encrypt/Decrypt some data and/or finalize the encryption/decryption.
int botan_mac_output_length(botan_mac_t mac, size_t *output_length)
int(* botan_view_str_fn)(botan_view_ctx view_ctx, const char *str, size_t len)
int botan_constant_time_compare(const uint8_t *x, const uint8_t *y, size_t len)
int botan_mp_is_negative(botan_mp_t mp)
int botan_hex_decode(const char *hex_str, size_t in_len, uint8_t *out, size_t *out_len)
int botan_mac_set_key(botan_mac_t mac, const uint8_t *key, size_t key_len)
int botan_kdf(const char *kdf_algo, uint8_t out[], size_t out_len, const uint8_t secret[], size_t secret_len, const uint8_t salt[], size_t salt_len, const uint8_t label[], size_t label_len)
int botan_mp_sub(botan_mp_t result, botan_mp_t x, botan_mp_t y)
int botan_privkey_create_ecdh(botan_privkey_t *key, botan_rng_t rng, const char *params)
int botan_rng_init(botan_rng_t *rng, const char *rng_type)
int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
int botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t *nl)
int botan_mp_is_positive(botan_mp_t mp)
int botan_privkey_view_pem(botan_privkey_t key, botan_view_ctx ctx, botan_view_str_fn view)
int botan_nist_kw_dec(const char *cipher_algo, int padded, const uint8_t wrapped_key[], size_t wrapped_key_len, const uint8_t kek[], size_t kek_len, uint8_t key[], size_t *key_len)
int botan_cipher_get_update_granularity(botan_cipher_t cipher, size_t *ug)
int botan_pbkdf_timed(const char *pbkdf_algo, uint8_t out[], size_t out_len, const char *passphrase, const uint8_t salt[], size_t salt_len, size_t milliseconds_to_run, size_t *out_iterations_used)
int botan_mac_clear(botan_mac_t mac)
int botan_mp_to_str(botan_mp_t mp, uint8_t base, char *out, size_t *out_len)
int botan_block_cipher_set_key(botan_block_cipher_t bc, const uint8_t key[], size_t len)
int botan_mp_set_bit(botan_mp_t n, size_t bit)
int botan_bcrypt_is_valid(const char *pass, const char *hash)
int botan_mp_set_from_mp(botan_mp_t dest, botan_mp_t source)
struct botan_hash_struct * botan_hash_t