51#include <botan/build.h>
153#define BOTAN_FFI_HEX_LOWER_CASE 1
184 uint8_t* out,
size_t* out_len);
243 const uint8_t* entropy,
408 size_t* out_minimum_keylength,
409 size_t* out_maximum_keylength,
410 size_t* out_keylength_modulo);
424#define BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION 1
425#define BOTAN_CIPHER_INIT_FLAG_ENCRYPT 0
426#define BOTAN_CIPHER_INIT_FLAG_DECRYPT 1
468 size_t* out_minimum_keylength,
469 size_t* out_maximum_keylength);
483 const uint8_t* key,
size_t key_len);
499 const uint8_t* ad,
size_t ad_len);
505 const uint8_t* nonce,
size_t nonce_len);
507#define BOTAN_CIPHER_UPDATE_FLAG_FINAL (1U << 0)
516 size_t* output_written,
517 const uint8_t input_bytes[],
519 size_t* input_consumed);
550 uint8_t out[],
size_t out_len,
551 const
char* passphrase,
552 const uint8_t salt[],
size_t salt_len,
580 uint8_t out[],
size_t out_len,
581 const
char* passphrase,
582 const uint8_t salt[],
size_t salt_len,
583 size_t milliseconds_to_run,
584 size_t* out_iterations_used);
609 const
char* passphrase,
610 size_t passphrase_len,
611 const uint8_t salt[],
638 const
char* passphrase,
639 size_t passphrase_len,
640 const uint8_t salt[],
651 const
char* passphrase,
652 const uint8_t salt[],
size_t salt_len,
653 size_t N,
size_t r,
size_t p);
669 uint8_t out[],
size_t out_len,
670 const uint8_t secret[],
size_t secret_len,
671 const uint8_t salt[],
size_t salt_len,
672 const uint8_t label[],
size_t label_len);
683 const
char* cipher_name);
701 const uint8_t key[],
size_t len);
732 char*
name,
size_t* name_len);
743 size_t* out_minimum_keylength,
744 size_t* out_maximum_keylength,
745 size_t* out_keylength_modulo);
933 const
char* password,
962 const
char* algo_name,
963 const
char* algo_params,
966#define BOTAN_CHECK_KEY_EXPENSIVE_TESTS 1
1037 const uint8_t bits[],
size_t len,
1038 const
char* password);
1045#define BOTAN_PRIVKEY_EXPORT_FLAG_DER 0
1046#define BOTAN_PRIVKEY_EXPORT_FLAG_PEM 1
1056 uint8_t out[],
size_t* out_len,
1064BOTAN_DEPRECATED("Use botan_privkey_export_encrypted_pbkdf_{msec,iter}
")
1065BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted(botan_privkey_t key,
1066 uint8_t out[], size_t* out_len,
1068 const char* passphrase,
1069 const char* encryption_algo,
1073* Export a private key, running PBKDF for specified amount of time
1074* @param key the private key to export
1076BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted_pbkdf_msec(botan_privkey_t key,
1077 uint8_t out[], size_t* out_len,
1079 const char* passphrase,
1080 uint32_t pbkdf_msec_runtime,
1081 size_t* pbkdf_iterations_out,
1082 const char* cipher_algo,
1083 const char* pbkdf_algo,
1089BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted_pbkdf_iter(botan_privkey_t key,
1090 uint8_t out[], size_t* out_len,
1092 const char* passphrase,
1093 size_t pbkdf_iterations,
1094 const char* cipher_algo,
1095 const char* pbkdf_algo,
1098typedef struct botan_pubkey_struct* botan_pubkey_t;
1100BOTAN_PUBLIC_API(2,0) int botan_pubkey_load(botan_pubkey_t* key, const uint8_t bits[], size_t len);
1102BOTAN_PUBLIC_API(2,0) int botan_privkey_export_pubkey(botan_pubkey_t* out, botan_privkey_t in);
1104BOTAN_PUBLIC_API(2,0) int botan_pubkey_export(botan_pubkey_t key, uint8_t out[], size_t* out_len, uint32_t flags);
1106BOTAN_PUBLIC_API(2,0) int botan_pubkey_algo_name(botan_pubkey_t key, char out[], size_t* out_len);
1111BOTAN_PUBLIC_API(2,0) int botan_pubkey_check_key(botan_pubkey_t key, botan_rng_t rng, uint32_t flags);
1113BOTAN_PUBLIC_API(2,0) int botan_pubkey_estimated_strength(botan_pubkey_t key, size_t* estimate);
1115BOTAN_PUBLIC_API(2,0) int botan_pubkey_fingerprint(botan_pubkey_t key, const char* hash,
1116 uint8_t out[], size_t* out_len);
1121BOTAN_PUBLIC_API(2,0) int botan_pubkey_destroy(botan_pubkey_t key);
1124* Get arbitrary named fields from public or privat keys
1126BOTAN_PUBLIC_API(2,0) int botan_pubkey_get_field(botan_mp_t output,
1128 const char* field_name);
1130BOTAN_PUBLIC_API(2,0) int botan_privkey_get_field(botan_mp_t output,
1131 botan_privkey_t key,
1132 const char* field_name);
1135* Algorithm specific key operations: RSA
1137BOTAN_PUBLIC_API(2,0) int botan_privkey_load_rsa(botan_privkey_t* key,
1142BOTAN_PUBLIC_API(2,8) int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key,
1143 const uint8_t bits[],
1147int botan_privkey_rsa_get_p(botan_mp_t p, botan_privkey_t rsa_key);
1149int botan_privkey_rsa_get_q(botan_mp_t q, botan_privkey_t rsa_key);
1151int botan_privkey_rsa_get_d(botan_mp_t d, botan_privkey_t rsa_key);
1153int botan_privkey_rsa_get_n(botan_mp_t n, botan_privkey_t rsa_key);
1155int botan_privkey_rsa_get_e(botan_mp_t e, botan_privkey_t rsa_key);
1157BOTAN_PUBLIC_API(2,8) int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key,
1158 uint8_t out[], size_t* out_len,
1161BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_rsa(botan_pubkey_t* key,
1166int botan_pubkey_rsa_get_e(botan_mp_t e, botan_pubkey_t rsa_key);
1168int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t rsa_key);
1171* Algorithm specific key operations: DSA
1173BOTAN_PUBLIC_API(2,0) int botan_privkey_load_dsa(botan_privkey_t* key,
1179BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_dsa(botan_pubkey_t* key,
1186int botan_privkey_dsa_get_x(botan_mp_t n, botan_privkey_t key);
1189int botan_pubkey_dsa_get_p(botan_mp_t p, botan_pubkey_t key);
1191int botan_pubkey_dsa_get_q(botan_mp_t q, botan_pubkey_t key);
1193int botan_pubkey_dsa_get_g(botan_mp_t d, botan_pubkey_t key);
1195int botan_pubkey_dsa_get_y(botan_mp_t y, botan_pubkey_t key);
1198* Loads Diffie Hellman private key
1200* @param key variable populated with key material
1201* @param p prime order of a Z_p group
1202* @param g group generator
1203* @param x private key
1205* @pre key is NULL on input
1206* @post function allocates memory and assigns to `key'
1208* @return 0 on success, a negative value on failure
1210BOTAN_PUBLIC_API(2,0) int botan_privkey_load_dh(botan_privkey_t* key,
1227BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_dh(botan_pubkey_t* key,
1233* Algorithm specific key operations: ElGamal
1248BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_elgamal(botan_pubkey_t* key,
1266BOTAN_PUBLIC_API(2,0) int botan_privkey_load_elgamal(botan_privkey_t* key,
1272* Algorithm specific key operations: Ed25519
1275BOTAN_PUBLIC_API(2,2) int botan_privkey_load_ed25519(botan_privkey_t* key,
1276 const uint8_t privkey[32]);
1278BOTAN_PUBLIC_API(2,2) int botan_pubkey_load_ed25519(botan_pubkey_t* key,
1279 const uint8_t pubkey[32]);
1281BOTAN_PUBLIC_API(2,2) int botan_privkey_ed25519_get_privkey(botan_privkey_t key,
1282 uint8_t output[64]);
1284BOTAN_PUBLIC_API(2,2) int botan_pubkey_ed25519_get_pubkey(botan_pubkey_t key,
1285 uint8_t pubkey[32]);
1288* Algorithm specific key operations: X25519
1291BOTAN_PUBLIC_API(2,8) int botan_privkey_load_x25519(botan_privkey_t* key,
1292 const uint8_t privkey[32]);
1294BOTAN_PUBLIC_API(2,8) int botan_pubkey_load_x25519(botan_pubkey_t* key,
1295 const uint8_t pubkey[32]);
1297BOTAN_PUBLIC_API(2,8) int botan_privkey_x25519_get_privkey(botan_privkey_t key,
1298 uint8_t output[32]);
1300BOTAN_PUBLIC_API(2,8) int botan_pubkey_x25519_get_pubkey(botan_pubkey_t key,
1301 uint8_t pubkey[32]);
1304* Algorithm specific key operations: ECDSA and ECDH
1306BOTAN_PUBLIC_API(2,2)
1307int botan_privkey_load_ecdsa(botan_privkey_t* key,
1308 const botan_mp_t scalar,
1309 const char* curve_name);
1311BOTAN_PUBLIC_API(2,2)
1312int botan_pubkey_load_ecdsa(botan_pubkey_t* key,
1313 const botan_mp_t public_x,
1314 const botan_mp_t public_y,
1315 const char* curve_name);
1317BOTAN_PUBLIC_API(2,2)
1318int botan_pubkey_load_ecdh(botan_pubkey_t* key,
1319 const botan_mp_t public_x,
1320 const botan_mp_t public_y,
1321 const char* curve_name);
1323BOTAN_PUBLIC_API(2,2)
1324int botan_privkey_load_ecdh(botan_privkey_t* key,
1325 const botan_mp_t scalar,
1326 const char* curve_name);
1328BOTAN_PUBLIC_API(2,2)
1329int botan_pubkey_load_sm2(botan_pubkey_t* key,
1330 const botan_mp_t public_x,
1331 const botan_mp_t public_y,
1332 const char* curve_name);
1334BOTAN_PUBLIC_API(2,2)
1335int botan_privkey_load_sm2(botan_privkey_t* key,
1336 const botan_mp_t scalar,
1337 const char* curve_name);
1340int botan_pubkey_load_sm2_enc(botan_pubkey_t* key,
1341 const botan_mp_t public_x,
1342 const botan_mp_t public_y,
1343 const char* curve_name);
1346int botan_privkey_load_sm2_enc(botan_privkey_t* key,
1347 const botan_mp_t scalar,
1348 const char* curve_name);
1350BOTAN_PUBLIC_API(2,3)
1351int botan_pubkey_sm2_compute_za(uint8_t out[],
1354 const char* hash_algo,
1355 const botan_pubkey_t key);
1358* Public Key Encryption
1360typedef struct botan_pk_op_encrypt_struct* botan_pk_op_encrypt_t;
1362BOTAN_PUBLIC_API(2,0) int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op,
1364 const char* padding,
1370BOTAN_PUBLIC_API(2,0) int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op);
1372BOTAN_PUBLIC_API(2,8) int botan_pk_op_encrypt_output_length(botan_pk_op_encrypt_t op,
1376BOTAN_PUBLIC_API(2,0) int botan_pk_op_encrypt(botan_pk_op_encrypt_t op,
1380 const uint8_t plaintext[],
1381 size_t plaintext_len);
1384* Public Key Decryption
1386typedef struct botan_pk_op_decrypt_struct* botan_pk_op_decrypt_t;
1388BOTAN_PUBLIC_API(2,0) int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op,
1389 botan_privkey_t key,
1390 const char* padding,
1396BOTAN_PUBLIC_API(2,0) int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op);
1398BOTAN_PUBLIC_API(2,8) int botan_pk_op_decrypt_output_length(botan_pk_op_decrypt_t op,
1402BOTAN_PUBLIC_API(2,0) int botan_pk_op_decrypt(botan_pk_op_decrypt_t op,
1403 uint8_t out[], size_t* out_len,
1404 const uint8_t ciphertext[], size_t ciphertext_len);
1407* Signature Generation
1410#define BOTAN_PUBKEY_DER_FORMAT_SIGNATURE 1
1412typedef struct botan_pk_op_sign_struct* botan_pk_op_sign_t;
1414BOTAN_PUBLIC_API(2,0)
1415int botan_pk_op_sign_create(botan_pk_op_sign_t* op,
1416 botan_privkey_t key,
1417 const char* hash_and_padding,
1423BOTAN_PUBLIC_API(2,0) int botan_pk_op_sign_destroy(botan_pk_op_sign_t op);
1425BOTAN_PUBLIC_API(2,8) int botan_pk_op_sign_output_length(botan_pk_op_sign_t op, size_t* olen);
1427BOTAN_PUBLIC_API(2,0) int botan_pk_op_sign_update(botan_pk_op_sign_t op, const uint8_t in[], size_t in_len);
1429BOTAN_PUBLIC_API(2,0)
1430int botan_pk_op_sign_finish(botan_pk_op_sign_t op, botan_rng_t rng,
1431 uint8_t sig[], size_t* sig_len);
1434* Signature Verification
1436typedef struct botan_pk_op_verify_struct* botan_pk_op_verify_t;
1438BOTAN_PUBLIC_API(2,0)
1439int botan_pk_op_verify_create(botan_pk_op_verify_t* op,
1441 const char* hash_and_padding,
1447BOTAN_PUBLIC_API(2,0) int botan_pk_op_verify_destroy(botan_pk_op_verify_t op);
1449BOTAN_PUBLIC_API(2,0) int botan_pk_op_verify_update(botan_pk_op_verify_t op, const uint8_t in[], size_t in_len);
1450BOTAN_PUBLIC_API(2,0) int botan_pk_op_verify_finish(botan_pk_op_verify_t op, const uint8_t sig[], size_t sig_len);
1455typedef struct botan_pk_op_ka_struct* botan_pk_op_ka_t;
1457BOTAN_PUBLIC_API(2,0)
1458int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op,
1459 botan_privkey_t key,
1466BOTAN_PUBLIC_API(2,0) int botan_pk_op_key_agreement_destroy(botan_pk_op_ka_t op);
1468BOTAN_PUBLIC_API(2,0) int botan_pk_op_key_agreement_export_public(botan_privkey_t key,
1469 uint8_t out[], size_t* out_len);
1471BOTAN_PUBLIC_API(2,8) int botan_pk_op_key_agreement_size(botan_pk_op_ka_t op, size_t* out_len);
1473BOTAN_PUBLIC_API(2,0)
1474int botan_pk_op_key_agreement(botan_pk_op_ka_t op,
1475 uint8_t out[], size_t* out_len,
1476 const uint8_t other_key[], size_t other_key_len,
1477 const uint8_t salt[], size_t salt_len);
1479BOTAN_PUBLIC_API(2,0) int botan_pkcs_hash_id(const char* hash_name, uint8_t pkcs_id[], size_t* pkcs_id_len);
1484* @param mce_key must be a McEliece key
1485* ct_len should be pt_len + n/8 + a few?
1487BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("Poorly specified, avoid in
new code
")
1488int botan_mceies_encrypt(botan_pubkey_t mce_key,
1491 const uint8_t pt[], size_t pt_len,
1492 const uint8_t ad[], size_t ad_len,
1493 uint8_t ct[], size_t* ct_len);
1495BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("Poorly specified, avoid in
new code
")
1496int botan_mceies_decrypt(botan_privkey_t mce_key,
1498 const uint8_t ct[], size_t ct_len,
1499 const uint8_t ad[], size_t ad_len,
1500 uint8_t pt[], size_t* pt_len);
1504**************************/
1506typedef struct botan_x509_cert_struct* botan_x509_cert_t;
1508BOTAN_PUBLIC_API(2,0) int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert[], size_t cert_len);
1509BOTAN_PUBLIC_API(2,0) int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* filename);
1514BOTAN_PUBLIC_API(2,0) int botan_x509_cert_destroy(botan_x509_cert_t cert);
1516BOTAN_PUBLIC_API(2,8) int botan_x509_cert_dup(botan_x509_cert_t* new_cert, botan_x509_cert_t cert);
1518/* Prefer botan_x509_cert_not_before and botan_x509_cert_not_after */
1519BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t* out_len);
1520BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t* out_len);
1522BOTAN_PUBLIC_API(2,8) int botan_x509_cert_not_before(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1523BOTAN_PUBLIC_API(2,8) int botan_x509_cert_not_after(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1525BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char* hash, uint8_t out[], size_t* out_len);
1527BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1528BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1529BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1531BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert,
1532 uint8_t out[], size_t* out_len);
1534BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t* key);
1536BOTAN_PUBLIC_API(2,0)
1537int botan_x509_cert_get_issuer_dn(botan_x509_cert_t cert,
1538 const char* key, size_t index,
1539 uint8_t out[], size_t* out_len);
1541BOTAN_PUBLIC_API(2,0)
1542int botan_x509_cert_get_subject_dn(botan_x509_cert_t cert,
1543 const char* key, size_t index,
1544 uint8_t out[], size_t* out_len);
1546BOTAN_PUBLIC_API(2,0) int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t* out_len);
1548/* Must match values of Key_Constraints in key_constraints.h */
1549enum botan_x509_cert_key_constraints {
1551 DIGITAL_SIGNATURE = 32768,
1552 NON_REPUDIATION = 16384,
1553 KEY_ENCIPHERMENT = 8192,
1554 DATA_ENCIPHERMENT = 4096,
1555 KEY_AGREEMENT = 2048,
1556 KEY_CERT_SIGN = 1024,
1558 ENCIPHER_ONLY = 256,
1562BOTAN_PUBLIC_API(2,0) int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage);
1568BOTAN_PUBLIC_API(2,5) int botan_x509_cert_hostname_match(botan_x509_cert_t cert, const char* hostname);
1578BOTAN_PUBLIC_API(2,8) int botan_x509_cert_verify(
1579 int* validation_result,
1580 botan_x509_cert_t cert,
1581 const botan_x509_cert_t* intermediates,
1582 size_t intermediates_len,
1583 const botan_x509_cert_t* trusted,
1585 const char* trusted_path,
1586 size_t required_strength,
1587 const char* hostname,
1588 uint64_t reference_time);
1594BOTAN_PUBLIC_API(2,8) const char* botan_x509_cert_validation_status(int code);
1598**************************/
1600typedef struct botan_x509_crl_struct* botan_x509_crl_t;
1602BOTAN_PUBLIC_API(2,13) int botan_x509_crl_load_file(botan_x509_crl_t* crl_obj, const char* crl_path);
1603BOTAN_PUBLIC_API(2,13) int botan_x509_crl_load(botan_x509_crl_t* crl_obj, const uint8_t crl_bits[], size_t crl_bits_len);
1605BOTAN_PUBLIC_API(2,13) int botan_x509_crl_destroy(botan_x509_crl_t crl);
1611BOTAN_PUBLIC_API(2,13) int botan_x509_is_revoked(botan_x509_crl_t crl, botan_x509_cert_t cert);
1617BOTAN_PUBLIC_API(2,13) int botan_x509_cert_verify_with_crl(
1618 int* validation_result,
1619 botan_x509_cert_t cert,
1620 const botan_x509_cert_t* intermediates,
1621 size_t intermediates_len,
1622 const botan_x509_cert_t* trusted,
1624 const botan_x509_crl_t* crls,
1626 const char* trusted_path,
1627 size_t required_strength,
1628 const char* hostname,
1629 uint64_t reference_time);
1634BOTAN_PUBLIC_API(2,2)
1635int botan_key_wrap3394(const uint8_t key[], size_t key_len,
1636 const uint8_t kek[], size_t kek_len,
1637 uint8_t wrapped_key[], size_t *wrapped_key_len);
1639BOTAN_PUBLIC_API(2,2)
1640int botan_key_unwrap3394(const uint8_t wrapped_key[], size_t wrapped_key_len,
1641 const uint8_t kek[], size_t kek_len,
1642 uint8_t key[], size_t *key_len);
1648typedef struct botan_hotp_struct* botan_hotp_t;
1653BOTAN_PUBLIC_API(2,8)
1654int botan_hotp_init(botan_hotp_t* hotp,
1655 const uint8_t key[], size_t key_len,
1656 const char* hash_algo,
1663BOTAN_PUBLIC_API(2,8)
1664int botan_hotp_destroy(botan_hotp_t hotp);
1669BOTAN_PUBLIC_API(2,8)
1670int botan_hotp_generate(botan_hotp_t hotp,
1671 uint32_t* hotp_code,
1672 uint64_t hotp_counter);
1677BOTAN_PUBLIC_API(2,8)
1678int botan_hotp_check(botan_hotp_t hotp,
1679 uint64_t* next_hotp_counter,
1681 uint64_t hotp_counter,
1682 size_t resync_range);
1689typedef struct botan_totp_struct* botan_totp_t;
1694BOTAN_PUBLIC_API(2,8)
1695int botan_totp_init(botan_totp_t* totp,
1696 const uint8_t key[], size_t key_len,
1697 const char* hash_algo,
1705BOTAN_PUBLIC_API(2,8)
1706int botan_totp_destroy(botan_totp_t totp);
1714BOTAN_PUBLIC_API(2,8)
1715int botan_totp_generate(botan_totp_t totp,
1716 uint32_t* totp_code,
1717 uint64_t timestamp);
1727BOTAN_PUBLIC_API(2,8)
1728int botan_totp_check(botan_totp_t totp,
1731 size_t acceptable_clock_drift);
1738typedef struct botan_fpe_struct* botan_fpe_t;
1740#define BOTAN_FPE_FLAG_FE1_COMPAT_MODE 1
1742BOTAN_PUBLIC_API(2,8)
1743int botan_fpe_fe1_init(botan_fpe_t* fpe, botan_mp_t n,
1744 const uint8_t key[], size_t key_len,
1745 size_t rounds, uint32_t flags);
1750BOTAN_PUBLIC_API(2,8)
1751int botan_fpe_destroy(botan_fpe_t fpe);
1753BOTAN_PUBLIC_API(2,8)
1754int botan_fpe_encrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
1756BOTAN_PUBLIC_API(2,8)
1757int botan_fpe_decrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
#define BOTAN_PUBLIC_API(maj, min)
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_rng_reseed_from_rng(botan_rng_t rng, botan_rng_t source_rng, size_t bits)
uint32_t botan_version_minor(void)
int botan_mp_set_from_int(botan_mp_t mp, int initial_value)
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_set_from_mp(botan_mp_t dest, const botan_mp_t source)
int botan_mp_to_bin(const botan_mp_t mp, uint8_t vec[])
int botan_hash_update(botan_hash_t hash, const uint8_t *in, size_t in_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_cmp(int *result, const botan_mp_t x, const botan_mp_t y)
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)
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_sub(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
int botan_privkey_create_dh(botan_privkey_t *key, botan_rng_t rng, const char *param)
int botan_pubkey_load_sm2(botan_pubkey_t *key, const botan_mp_t public_x, const botan_mp_t public_y, const char *curve_name)
int botan_hash_name(botan_hash_t hash, char *name, size_t *name_len)
int botan_mp_to_str(const botan_mp_t mp, uint8_t base, char *out, size_t *out_len)
int botan_mp_gcd(botan_mp_t out, const botan_mp_t x, const botan_mp_t y)
int botan_cipher_get_tag_length(botan_cipher_t cipher, size_t *tag_size)
int botan_mp_from_bin(const botan_mp_t mp, const uint8_t vec[], size_t vec_len)
int botan_privkey_get_field(botan_mp_t output, botan_privkey_t key, const char *field_name)
int botan_mp_add_u32(botan_mp_t result, const botan_mp_t x, uint32_t y)
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_mp_mod_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y, const botan_mp_t mod)
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)
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_mp_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
int botan_cipher_reset(botan_cipher_t cipher)
int botan_cipher_init(botan_cipher_t *cipher, const char *name, uint32_t flags)
int botan_mp_is_zero(const botan_mp_t mp)
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_block_cipher_block_size(botan_block_cipher_t bc)
int botan_mp_rand_range(botan_mp_t rand_out, botan_rng_t rng, const botan_mp_t lower_bound, const botan_mp_t upper_bound)
int botan_cipher_destroy(botan_cipher_t cipher)
int botan_mp_sub_u32(botan_mp_t result, const botan_mp_t x, uint32_t y)
int botan_mp_is_even(const botan_mp_t mp)
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_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
int botan_mp_is_prime(const botan_mp_t n, botan_rng_t rng, size_t test_prob)
int botan_hash_clear(botan_hash_t hash)
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_is_positive(const botan_mp_t mp)
int botan_hash_output_length(botan_hash_t hash, size_t *output_length)
int botan_privkey_load_sm2(botan_privkey_t *key, const botan_mp_t scalar, const char *curve_name)
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_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_mp_clear_bit(botan_mp_t n, size_t bit)
int botan_mp_mod_inverse(botan_mp_t out, const botan_mp_t in, const botan_mp_t modulus)
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)
struct botan_block_cipher_struct * botan_block_cipher_t
const char * botan_version_string(void)
int botan_mp_num_bits(const botan_mp_t n, size_t *bits)
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_hash_copy_state(botan_hash_t *dest, const botan_hash_t source)
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_scrub_mem(void *mem, size_t bytes)
int botan_privkey_create(botan_privkey_t *key, const char *algo_name, const char *algo_params, botan_rng_t rng)
int botan_mp_is_odd(const botan_mp_t mp)
int botan_mac_update(botan_mac_t mac, const uint8_t *buf, size_t len)
int botan_mp_div(botan_mp_t quotient, botan_mp_t remainder, const botan_mp_t x, const botan_mp_t y)
int botan_privkey_create_mceliece(botan_privkey_t *key, botan_rng_t rng, size_t n, size_t t)
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_mp_rshift(botan_mp_t out, const botan_mp_t in, size_t shift)
int botan_mp_powmod(botan_mp_t out, const botan_mp_t base, const botan_mp_t exponent, const botan_mp_t modulus)
int botan_mp_to_uint32(const botan_mp_t mp, uint32_t *val)
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)
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_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_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_negative(const botan_mp_t mp)
int botan_mp_get_bit(const botan_mp_t n, size_t bit)
int botan_mp_to_hex(const botan_mp_t mp, char *out)
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_mp_num_bytes(const botan_mp_t n, size_t *bytes)
int botan_hash_final(botan_hash_t hash, uint8_t out[])
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)
int botan_mac_output_length(botan_mac_t mac, size_t *output_length)
int botan_mp_add(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
int botan_constant_time_compare(const uint8_t *x, const uint8_t *y, size_t len)
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_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_mp_lshift(botan_mp_t out, const botan_mp_t in, size_t shift)
int botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t *nl)
int botan_mp_equal(const botan_mp_t x, const botan_mp_t y)
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_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)
struct botan_hash_struct * botan_hash_t