charm-crypto-framework 0.61.1__cp313-cp313-macosx_10_13_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- charm/__init__.py +5 -0
- charm/adapters/__init__.py +0 -0
- charm/adapters/abenc_adapt_hybrid.py +90 -0
- charm/adapters/dabenc_adapt_hybrid.py +145 -0
- charm/adapters/ibenc_adapt_hybrid.py +72 -0
- charm/adapters/ibenc_adapt_identityhash.py +80 -0
- charm/adapters/kpabenc_adapt_hybrid.py +91 -0
- charm/adapters/pkenc_adapt_bchk05.py +121 -0
- charm/adapters/pkenc_adapt_chk04.py +91 -0
- charm/adapters/pkenc_adapt_hybrid.py +98 -0
- charm/adapters/pksig_adapt_naor01.py +89 -0
- charm/config.py +7 -0
- charm/core/__init__.py +0 -0
- charm/core/benchmark/benchmark_util.c +353 -0
- charm/core/benchmark/benchmark_util.h +61 -0
- charm/core/benchmark/benchmarkmodule.c +476 -0
- charm/core/benchmark/benchmarkmodule.h +162 -0
- charm/core/benchmark.cpython-313-darwin.so +0 -0
- charm/core/crypto/AES/AES.c +1464 -0
- charm/core/crypto/AES.cpython-313-darwin.so +0 -0
- charm/core/crypto/DES/DES.c +113 -0
- charm/core/crypto/DES.cpython-313-darwin.so +0 -0
- charm/core/crypto/DES3/DES3.c +26 -0
- charm/core/crypto/DES3.cpython-313-darwin.so +0 -0
- charm/core/crypto/__init__.py +0 -0
- charm/core/crypto/cryptobase/XOR.c +80 -0
- charm/core/crypto/cryptobase/_counter.c +496 -0
- charm/core/crypto/cryptobase/_counter.h +54 -0
- charm/core/crypto/cryptobase/block_template.c +900 -0
- charm/core/crypto/cryptobase/block_template.h +69 -0
- charm/core/crypto/cryptobase/cryptobasemodule.c +220 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt.h +90 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_argchk.h +44 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_cfg.h +186 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_cipher.h +941 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_custom.h +556 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_des.c +1912 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_hash.h +407 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_mac.h +496 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_macros.h +435 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_math.h +534 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_misc.h +103 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_pk.h +653 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_pkcs.h +90 -0
- charm/core/crypto/cryptobase/libtom/tomcrypt_prng.h +199 -0
- charm/core/crypto/cryptobase/stream_template.c +271 -0
- charm/core/crypto/cryptobase/strxor.c +229 -0
- charm/core/crypto/cryptobase.cpython-313-darwin.so +0 -0
- charm/core/engine/__init__.py +5 -0
- charm/core/engine/protocol.py +293 -0
- charm/core/engine/util.py +174 -0
- charm/core/math/__init__.py +0 -0
- charm/core/math/elliptic_curve/ecmodule.c +1986 -0
- charm/core/math/elliptic_curve/ecmodule.h +230 -0
- charm/core/math/elliptic_curve.cpython-313-darwin.so +0 -0
- charm/core/math/elliptic_curve.pyi +63 -0
- charm/core/math/integer/integermodule.c +2539 -0
- charm/core/math/integer/integermodule.h +145 -0
- charm/core/math/integer.cpython-313-darwin.so +0 -0
- charm/core/math/integer.pyi +76 -0
- charm/core/math/pairing/miracl/miracl_config.h +37 -0
- charm/core/math/pairing/miracl/miracl_interface.h +118 -0
- charm/core/math/pairing/miracl/miracl_interface2.h +126 -0
- charm/core/math/pairing/miracl/pairingmodule2.c +2094 -0
- charm/core/math/pairing/miracl/pairingmodule2.h +307 -0
- charm/core/math/pairing/pairingmodule.c +2230 -0
- charm/core/math/pairing/pairingmodule.h +241 -0
- charm/core/math/pairing/relic/pairingmodule3.c +1853 -0
- charm/core/math/pairing/relic/pairingmodule3.h +233 -0
- charm/core/math/pairing/relic/relic_interface.c +1337 -0
- charm/core/math/pairing/relic/relic_interface.h +217 -0
- charm/core/math/pairing/relic/test_relic.c +171 -0
- charm/core/math/pairing.cpython-313-darwin.so +0 -0
- charm/core/math/pairing.pyi +69 -0
- charm/core/utilities/base64.c +248 -0
- charm/core/utilities/base64.h +15 -0
- charm/schemes/__init__.py +0 -0
- charm/schemes/abenc/__init__.py +0 -0
- charm/schemes/abenc/abenc_accountability_jyjxgd20.py +647 -0
- charm/schemes/abenc/abenc_bsw07.py +146 -0
- charm/schemes/abenc/abenc_ca_cpabe_ar17.py +684 -0
- charm/schemes/abenc/abenc_dacmacs_yj14.py +298 -0
- charm/schemes/abenc/abenc_lsw08.py +159 -0
- charm/schemes/abenc/abenc_maabe_rw15.py +236 -0
- charm/schemes/abenc/abenc_maabe_yj14.py +297 -0
- charm/schemes/abenc/abenc_tbpre_lww14.py +309 -0
- charm/schemes/abenc/abenc_unmcpabe_yahk14.py +223 -0
- charm/schemes/abenc/abenc_waters09.py +144 -0
- charm/schemes/abenc/abenc_yct14.py +208 -0
- charm/schemes/abenc/abenc_yllc15.py +178 -0
- charm/schemes/abenc/ac17.py +248 -0
- charm/schemes/abenc/bsw07.py +141 -0
- charm/schemes/abenc/cgw15.py +277 -0
- charm/schemes/abenc/dabe_aw11.py +204 -0
- charm/schemes/abenc/dfa_fe12.py +144 -0
- charm/schemes/abenc/pk_hve08.py +179 -0
- charm/schemes/abenc/waters11.py +143 -0
- charm/schemes/aggrsign_MuSig.py +150 -0
- charm/schemes/aggrsign_bls.py +267 -0
- charm/schemes/blindsig_ps16.py +654 -0
- charm/schemes/chamhash_adm05.py +113 -0
- charm/schemes/chamhash_rsa_hw09.py +100 -0
- charm/schemes/commit/__init__.py +0 -0
- charm/schemes/commit/commit_gs08.py +77 -0
- charm/schemes/commit/commit_pedersen92.py +53 -0
- charm/schemes/encap_bchk05.py +62 -0
- charm/schemes/grpsig/__init__.py +0 -0
- charm/schemes/grpsig/groupsig_bgls04.py +114 -0
- charm/schemes/grpsig/groupsig_bgls04_var.py +115 -0
- charm/schemes/hibenc/__init__.py +0 -0
- charm/schemes/hibenc/hibenc_bb04.py +105 -0
- charm/schemes/hibenc/hibenc_lew11.py +193 -0
- charm/schemes/ibenc/__init__.py +0 -0
- charm/schemes/ibenc/clpkc_rp03.py +119 -0
- charm/schemes/ibenc/ibenc_CW13_z.py +168 -0
- charm/schemes/ibenc/ibenc_bb03.py +94 -0
- charm/schemes/ibenc/ibenc_bf01.py +121 -0
- charm/schemes/ibenc/ibenc_ckrs09.py +120 -0
- charm/schemes/ibenc/ibenc_cllww12_z.py +172 -0
- charm/schemes/ibenc/ibenc_lsw08.py +120 -0
- charm/schemes/ibenc/ibenc_sw05.py +238 -0
- charm/schemes/ibenc/ibenc_waters05.py +144 -0
- charm/schemes/ibenc/ibenc_waters05_z.py +164 -0
- charm/schemes/ibenc/ibenc_waters09.py +107 -0
- charm/schemes/ibenc/ibenc_waters09_z.py +147 -0
- charm/schemes/joye_scheme.py +106 -0
- charm/schemes/lem_scheme.py +207 -0
- charm/schemes/pk_fre_ccv11.py +107 -0
- charm/schemes/pk_vrf.py +127 -0
- charm/schemes/pkenc/__init__.py +0 -0
- charm/schemes/pkenc/pkenc_cs98.py +108 -0
- charm/schemes/pkenc/pkenc_elgamal85.py +122 -0
- charm/schemes/pkenc/pkenc_gm82.py +98 -0
- charm/schemes/pkenc/pkenc_paillier99.py +118 -0
- charm/schemes/pkenc/pkenc_rabin.py +254 -0
- charm/schemes/pkenc/pkenc_rsa.py +186 -0
- charm/schemes/pksig/__init__.py +0 -0
- charm/schemes/pksig/pksig_CW13_z.py +135 -0
- charm/schemes/pksig/pksig_bls04.py +87 -0
- charm/schemes/pksig/pksig_boyen.py +156 -0
- charm/schemes/pksig/pksig_chch.py +97 -0
- charm/schemes/pksig/pksig_chp.py +70 -0
- charm/schemes/pksig/pksig_cl03.py +150 -0
- charm/schemes/pksig/pksig_cl04.py +87 -0
- charm/schemes/pksig/pksig_cllww12_z.py +142 -0
- charm/schemes/pksig/pksig_cyh.py +132 -0
- charm/schemes/pksig/pksig_dsa.py +76 -0
- charm/schemes/pksig/pksig_ecdsa.py +71 -0
- charm/schemes/pksig/pksig_hess.py +104 -0
- charm/schemes/pksig/pksig_hw.py +110 -0
- charm/schemes/pksig/pksig_lamport.py +63 -0
- charm/schemes/pksig/pksig_ps01.py +135 -0
- charm/schemes/pksig/pksig_ps02.py +124 -0
- charm/schemes/pksig/pksig_ps03.py +119 -0
- charm/schemes/pksig/pksig_rsa_hw09.py +206 -0
- charm/schemes/pksig/pksig_schnorr91.py +77 -0
- charm/schemes/pksig/pksig_waters.py +115 -0
- charm/schemes/pksig/pksig_waters05.py +121 -0
- charm/schemes/pksig/pksig_waters09.py +121 -0
- charm/schemes/pre_mg07.py +150 -0
- charm/schemes/prenc/pre_afgh06.py +126 -0
- charm/schemes/prenc/pre_bbs98.py +123 -0
- charm/schemes/prenc/pre_nal16.py +216 -0
- charm/schemes/protocol_a01.py +272 -0
- charm/schemes/protocol_ao00.py +215 -0
- charm/schemes/protocol_cns07.py +274 -0
- charm/schemes/protocol_schnorr91.py +125 -0
- charm/schemes/sigma1.py +64 -0
- charm/schemes/sigma2.py +129 -0
- charm/schemes/sigma3.py +126 -0
- charm/schemes/threshold/__init__.py +59 -0
- charm/schemes/threshold/dkls23_dkg.py +556 -0
- charm/schemes/threshold/dkls23_presign.py +1089 -0
- charm/schemes/threshold/dkls23_sign.py +761 -0
- charm/schemes/threshold/xrpl_wallet.py +967 -0
- charm/test/__init__.py +0 -0
- charm/test/adapters/__init__.py +0 -0
- charm/test/adapters/abenc_adapt_hybrid_test.py +29 -0
- charm/test/adapters/dabenc_adapt_hybrid_test.py +56 -0
- charm/test/adapters/ibenc_adapt_hybrid_test.py +36 -0
- charm/test/adapters/ibenc_adapt_identityhash_test.py +32 -0
- charm/test/adapters/kpabenc_adapt_hybrid_test.py +30 -0
- charm/test/benchmark/abenc_yllc15_bench.py +92 -0
- charm/test/benchmark/benchmark_test.py +148 -0
- charm/test/benchmark_threshold.py +260 -0
- charm/test/conftest.py +38 -0
- charm/test/fuzz/__init__.py +1 -0
- charm/test/fuzz/conftest.py +5 -0
- charm/test/fuzz/fuzz_policy_parser.py +76 -0
- charm/test/fuzz/fuzz_serialization.py +83 -0
- charm/test/schemes/__init__.py +0 -0
- charm/test/schemes/abenc/__init__.py +0 -0
- charm/test/schemes/abenc/abenc_bsw07_test.py +39 -0
- charm/test/schemes/abenc/abenc_dacmacs_yj14_test.py +16 -0
- charm/test/schemes/abenc/abenc_lsw08_test.py +33 -0
- charm/test/schemes/abenc/abenc_maabe_yj14_test.py +16 -0
- charm/test/schemes/abenc/abenc_tbpre_lww14_test.py +16 -0
- charm/test/schemes/abenc/abenc_waters09_test.py +38 -0
- charm/test/schemes/abenc/abenc_yllc15_test.py +74 -0
- charm/test/schemes/chamhash_adm05_test.py +31 -0
- charm/test/schemes/chamhash_rsa_hw09_test.py +29 -0
- charm/test/schemes/commit/__init__.py +0 -0
- charm/test/schemes/commit/commit_gs08_test.py +24 -0
- charm/test/schemes/commit/commit_pedersen92_test.py +26 -0
- charm/test/schemes/dabe_aw11_test.py +45 -0
- charm/test/schemes/encap_bchk05_test.py +21 -0
- charm/test/schemes/grpsig/__init__.py +0 -0
- charm/test/schemes/grpsig/groupsig_bgls04_test.py +35 -0
- charm/test/schemes/grpsig/groupsig_bgls04_var_test.py +39 -0
- charm/test/schemes/hibenc/__init__.py +0 -0
- charm/test/schemes/hibenc/hibenc_bb04_test.py +28 -0
- charm/test/schemes/ibenc/__init__.py +0 -0
- charm/test/schemes/ibenc/ibenc_bb03_test.py +26 -0
- charm/test/schemes/ibenc/ibenc_bf01_test.py +24 -0
- charm/test/schemes/ibenc/ibenc_ckrs09_test.py +25 -0
- charm/test/schemes/ibenc/ibenc_lsw08_test.py +31 -0
- charm/test/schemes/ibenc/ibenc_sw05_test.py +32 -0
- charm/test/schemes/ibenc/ibenc_waters05_test.py +31 -0
- charm/test/schemes/ibenc/ibenc_waters09_test.py +27 -0
- charm/test/schemes/pk_vrf_test.py +29 -0
- charm/test/schemes/pkenc/__init__.py +0 -0
- charm/test/schemes/pkenc_test.py +255 -0
- charm/test/schemes/pksig/__init__.py +0 -0
- charm/test/schemes/pksig_test.py +376 -0
- charm/test/schemes/rsa_alg_test.py +340 -0
- charm/test/schemes/threshold_test.py +1792 -0
- charm/test/serialize/__init__.py +0 -0
- charm/test/serialize/serialize_test.py +40 -0
- charm/test/toolbox/__init__.py +0 -0
- charm/test/toolbox/conversion_test.py +30 -0
- charm/test/toolbox/ecgroup_test.py +53 -0
- charm/test/toolbox/integer_arithmetic_test.py +441 -0
- charm/test/toolbox/paddingschemes_test.py +238 -0
- charm/test/toolbox/policy_parser_stress_test.py +969 -0
- charm/test/toolbox/secretshare_test.py +28 -0
- charm/test/toolbox/symcrypto_test.py +108 -0
- charm/test/toolbox/test_policy_expression.py +16 -0
- charm/test/vectors/__init__.py +1 -0
- charm/test/vectors/test_bls_vectors.py +289 -0
- charm/test/vectors/test_pedersen_vectors.py +315 -0
- charm/test/vectors/test_schnorr_vectors.py +368 -0
- charm/test/zkp_compiler/__init__.py +9 -0
- charm/test/zkp_compiler/benchmark_zkp.py +258 -0
- charm/test/zkp_compiler/test_and_proof.py +240 -0
- charm/test/zkp_compiler/test_batch_verify.py +248 -0
- charm/test/zkp_compiler/test_dleq_proof.py +264 -0
- charm/test/zkp_compiler/test_or_proof.py +231 -0
- charm/test/zkp_compiler/test_proof_serialization.py +121 -0
- charm/test/zkp_compiler/test_range_proof.py +241 -0
- charm/test/zkp_compiler/test_representation_proof.py +325 -0
- charm/test/zkp_compiler/test_schnorr_proof.py +221 -0
- charm/test/zkp_compiler/test_thread_safety.py +169 -0
- charm/test/zkp_compiler/test_zkp_parser.py +139 -0
- charm/toolbox/ABEnc.py +26 -0
- charm/toolbox/ABEncMultiAuth.py +66 -0
- charm/toolbox/ABEnumeric.py +800 -0
- charm/toolbox/Commit.py +24 -0
- charm/toolbox/DFA.py +89 -0
- charm/toolbox/FSA.py +1254 -0
- charm/toolbox/Hash.py +39 -0
- charm/toolbox/IBEnc.py +62 -0
- charm/toolbox/IBSig.py +64 -0
- charm/toolbox/PKEnc.py +66 -0
- charm/toolbox/PKSig.py +56 -0
- charm/toolbox/PREnc.py +32 -0
- charm/toolbox/ZKProof.py +289 -0
- charm/toolbox/__init__.py +0 -0
- charm/toolbox/bitstring.py +49 -0
- charm/toolbox/broadcast.py +220 -0
- charm/toolbox/conversion.py +100 -0
- charm/toolbox/eccurve.py +149 -0
- charm/toolbox/ecgroup.py +143 -0
- charm/toolbox/enum.py +60 -0
- charm/toolbox/hash_module.py +91 -0
- charm/toolbox/integergroup.py +323 -0
- charm/toolbox/iterate.py +22 -0
- charm/toolbox/matrixops.py +76 -0
- charm/toolbox/mpc_utils.py +296 -0
- charm/toolbox/msp.py +175 -0
- charm/toolbox/mta.py +985 -0
- charm/toolbox/node.py +120 -0
- charm/toolbox/ot/__init__.py +22 -0
- charm/toolbox/ot/base_ot.py +374 -0
- charm/toolbox/ot/dpf.py +642 -0
- charm/toolbox/ot/mpfss.py +228 -0
- charm/toolbox/ot/ot_extension.py +589 -0
- charm/toolbox/ot/silent_ot.py +378 -0
- charm/toolbox/paddingschemes.py +423 -0
- charm/toolbox/paddingschemes_test.py +238 -0
- charm/toolbox/pairingcurves.py +85 -0
- charm/toolbox/pairinggroup.py +186 -0
- charm/toolbox/policy_expression_spec.py +70 -0
- charm/toolbox/policytree.py +189 -0
- charm/toolbox/reCompiler.py +346 -0
- charm/toolbox/redundancyschemes.py +65 -0
- charm/toolbox/schemebase.py +188 -0
- charm/toolbox/secretshare.py +104 -0
- charm/toolbox/secretutil.py +174 -0
- charm/toolbox/securerandom.py +73 -0
- charm/toolbox/sigmaprotocol.py +46 -0
- charm/toolbox/specialprimes.py +45 -0
- charm/toolbox/symcrypto.py +279 -0
- charm/toolbox/threshold_sharing.py +553 -0
- charm/toolbox/xmlserialize.py +94 -0
- charm/toolbox/zknode.py +105 -0
- charm/zkp_compiler/__init__.py +89 -0
- charm/zkp_compiler/and_proof.py +460 -0
- charm/zkp_compiler/batch_verify.py +324 -0
- charm/zkp_compiler/dleq_proof.py +423 -0
- charm/zkp_compiler/or_proof.py +305 -0
- charm/zkp_compiler/range_proof.py +417 -0
- charm/zkp_compiler/representation_proof.py +466 -0
- charm/zkp_compiler/schnorr_proof.py +273 -0
- charm/zkp_compiler/thread_safe.py +150 -0
- charm/zkp_compiler/zk_demo.py +489 -0
- charm/zkp_compiler/zkp_factory.py +330 -0
- charm/zkp_compiler/zkp_generator.py +370 -0
- charm/zkp_compiler/zkparser.py +269 -0
- charm_crypto_framework-0.61.1.dist-info/METADATA +337 -0
- charm_crypto_framework-0.61.1.dist-info/RECORD +323 -0
- charm_crypto_framework-0.61.1.dist-info/WHEEL +5 -0
- charm_crypto_framework-0.61.1.dist-info/licenses/LICENSE.txt +165 -0
- charm_crypto_framework-0.61.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
#ifdef LTC_HMAC
|
|
2
|
+
typedef struct Hmac_state {
|
|
3
|
+
hash_state md;
|
|
4
|
+
int hash;
|
|
5
|
+
hash_state hashstate;
|
|
6
|
+
unsigned char *key;
|
|
7
|
+
} hmac_state;
|
|
8
|
+
|
|
9
|
+
int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned long keylen);
|
|
10
|
+
int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen);
|
|
11
|
+
int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen);
|
|
12
|
+
int hmac_test(void);
|
|
13
|
+
int hmac_memory(int hash,
|
|
14
|
+
const unsigned char *key, unsigned long keylen,
|
|
15
|
+
const unsigned char *in, unsigned long inlen,
|
|
16
|
+
unsigned char *out, unsigned long *outlen);
|
|
17
|
+
int hmac_memory_multi(int hash,
|
|
18
|
+
const unsigned char *key, unsigned long keylen,
|
|
19
|
+
unsigned char *out, unsigned long *outlen,
|
|
20
|
+
const unsigned char *in, unsigned long inlen, ...);
|
|
21
|
+
int hmac_file(int hash, const char *fname, const unsigned char *key,
|
|
22
|
+
unsigned long keylen,
|
|
23
|
+
unsigned char *dst, unsigned long *dstlen);
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
#ifdef LTC_OMAC
|
|
27
|
+
|
|
28
|
+
typedef struct {
|
|
29
|
+
int cipher_idx,
|
|
30
|
+
buflen,
|
|
31
|
+
blklen;
|
|
32
|
+
unsigned char block[MAXBLOCKSIZE],
|
|
33
|
+
prev[MAXBLOCKSIZE],
|
|
34
|
+
Lu[2][MAXBLOCKSIZE];
|
|
35
|
+
symmetric_key key;
|
|
36
|
+
} omac_state;
|
|
37
|
+
|
|
38
|
+
int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned long keylen);
|
|
39
|
+
int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen);
|
|
40
|
+
int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen);
|
|
41
|
+
int omac_memory(int cipher,
|
|
42
|
+
const unsigned char *key, unsigned long keylen,
|
|
43
|
+
const unsigned char *in, unsigned long inlen,
|
|
44
|
+
unsigned char *out, unsigned long *outlen);
|
|
45
|
+
int omac_memory_multi(int cipher,
|
|
46
|
+
const unsigned char *key, unsigned long keylen,
|
|
47
|
+
unsigned char *out, unsigned long *outlen,
|
|
48
|
+
const unsigned char *in, unsigned long inlen, ...);
|
|
49
|
+
int omac_file(int cipher,
|
|
50
|
+
const unsigned char *key, unsigned long keylen,
|
|
51
|
+
const char *filename,
|
|
52
|
+
unsigned char *out, unsigned long *outlen);
|
|
53
|
+
int omac_test(void);
|
|
54
|
+
#endif /* LTC_OMAC */
|
|
55
|
+
|
|
56
|
+
#ifdef LTC_PMAC
|
|
57
|
+
|
|
58
|
+
typedef struct {
|
|
59
|
+
unsigned char Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */
|
|
60
|
+
Li[MAXBLOCKSIZE], /* value of Li [current value, we calc from previous recall] */
|
|
61
|
+
Lr[MAXBLOCKSIZE], /* L * x^-1 */
|
|
62
|
+
block[MAXBLOCKSIZE], /* currently accumulated block */
|
|
63
|
+
checksum[MAXBLOCKSIZE]; /* current checksum */
|
|
64
|
+
|
|
65
|
+
symmetric_key key; /* scheduled key for cipher */
|
|
66
|
+
unsigned long block_index; /* index # for current block */
|
|
67
|
+
int cipher_idx, /* cipher idx */
|
|
68
|
+
block_len, /* length of block */
|
|
69
|
+
buflen; /* number of bytes in the buffer */
|
|
70
|
+
} pmac_state;
|
|
71
|
+
|
|
72
|
+
int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned long keylen);
|
|
73
|
+
int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen);
|
|
74
|
+
int pmac_done(pmac_state *pmac, unsigned char *out, unsigned long *outlen);
|
|
75
|
+
|
|
76
|
+
int pmac_memory(int cipher,
|
|
77
|
+
const unsigned char *key, unsigned long keylen,
|
|
78
|
+
const unsigned char *msg, unsigned long msglen,
|
|
79
|
+
unsigned char *out, unsigned long *outlen);
|
|
80
|
+
|
|
81
|
+
int pmac_memory_multi(int cipher,
|
|
82
|
+
const unsigned char *key, unsigned long keylen,
|
|
83
|
+
unsigned char *out, unsigned long *outlen,
|
|
84
|
+
const unsigned char *in, unsigned long inlen, ...);
|
|
85
|
+
|
|
86
|
+
int pmac_file(int cipher,
|
|
87
|
+
const unsigned char *key, unsigned long keylen,
|
|
88
|
+
const char *filename,
|
|
89
|
+
unsigned char *out, unsigned long *outlen);
|
|
90
|
+
|
|
91
|
+
int pmac_test(void);
|
|
92
|
+
|
|
93
|
+
/* internal functions */
|
|
94
|
+
int pmac_ntz(unsigned long x);
|
|
95
|
+
void pmac_shift_xor(pmac_state *pmac);
|
|
96
|
+
|
|
97
|
+
#endif /* PMAC */
|
|
98
|
+
|
|
99
|
+
#ifdef LTC_EAX_MODE
|
|
100
|
+
|
|
101
|
+
#if !(defined(LTC_OMAC) && defined(LTC_CTR_MODE))
|
|
102
|
+
#error LTC_EAX_MODE requires LTC_OMAC and CTR
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
typedef struct {
|
|
106
|
+
unsigned char N[MAXBLOCKSIZE];
|
|
107
|
+
symmetric_CTR ctr;
|
|
108
|
+
omac_state headeromac, ctomac;
|
|
109
|
+
} eax_state;
|
|
110
|
+
|
|
111
|
+
int eax_init(eax_state *eax, int cipher, const unsigned char *key, unsigned long keylen,
|
|
112
|
+
const unsigned char *nonce, unsigned long noncelen,
|
|
113
|
+
const unsigned char *header, unsigned long headerlen);
|
|
114
|
+
|
|
115
|
+
int eax_encrypt(eax_state *eax, const unsigned char *pt, unsigned char *ct, unsigned long length);
|
|
116
|
+
int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt, unsigned long length);
|
|
117
|
+
int eax_addheader(eax_state *eax, const unsigned char *header, unsigned long length);
|
|
118
|
+
int eax_done(eax_state *eax, unsigned char *tag, unsigned long *taglen);
|
|
119
|
+
|
|
120
|
+
int eax_encrypt_authenticate_memory(int cipher,
|
|
121
|
+
const unsigned char *key, unsigned long keylen,
|
|
122
|
+
const unsigned char *nonce, unsigned long noncelen,
|
|
123
|
+
const unsigned char *header, unsigned long headerlen,
|
|
124
|
+
const unsigned char *pt, unsigned long ptlen,
|
|
125
|
+
unsigned char *ct,
|
|
126
|
+
unsigned char *tag, unsigned long *taglen);
|
|
127
|
+
|
|
128
|
+
int eax_decrypt_verify_memory(int cipher,
|
|
129
|
+
const unsigned char *key, unsigned long keylen,
|
|
130
|
+
const unsigned char *nonce, unsigned long noncelen,
|
|
131
|
+
const unsigned char *header, unsigned long headerlen,
|
|
132
|
+
const unsigned char *ct, unsigned long ctlen,
|
|
133
|
+
unsigned char *pt,
|
|
134
|
+
unsigned char *tag, unsigned long taglen,
|
|
135
|
+
int *stat);
|
|
136
|
+
|
|
137
|
+
int eax_test(void);
|
|
138
|
+
#endif /* EAX MODE */
|
|
139
|
+
|
|
140
|
+
#ifdef LTC_OCB_MODE
|
|
141
|
+
typedef struct {
|
|
142
|
+
unsigned char L[MAXBLOCKSIZE], /* L value */
|
|
143
|
+
Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */
|
|
144
|
+
Li[MAXBLOCKSIZE], /* value of Li [current value, we calc from previous recall] */
|
|
145
|
+
Lr[MAXBLOCKSIZE], /* L * x^-1 */
|
|
146
|
+
R[MAXBLOCKSIZE], /* R value */
|
|
147
|
+
checksum[MAXBLOCKSIZE]; /* current checksum */
|
|
148
|
+
|
|
149
|
+
symmetric_key key; /* scheduled key for cipher */
|
|
150
|
+
unsigned long block_index; /* index # for current block */
|
|
151
|
+
int cipher, /* cipher idx */
|
|
152
|
+
block_len; /* length of block */
|
|
153
|
+
} ocb_state;
|
|
154
|
+
|
|
155
|
+
int ocb_init(ocb_state *ocb, int cipher,
|
|
156
|
+
const unsigned char *key, unsigned long keylen, const unsigned char *nonce);
|
|
157
|
+
|
|
158
|
+
int ocb_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned char *ct);
|
|
159
|
+
int ocb_decrypt(ocb_state *ocb, const unsigned char *ct, unsigned char *pt);
|
|
160
|
+
|
|
161
|
+
int ocb_done_encrypt(ocb_state *ocb,
|
|
162
|
+
const unsigned char *pt, unsigned long ptlen,
|
|
163
|
+
unsigned char *ct,
|
|
164
|
+
unsigned char *tag, unsigned long *taglen);
|
|
165
|
+
|
|
166
|
+
int ocb_done_decrypt(ocb_state *ocb,
|
|
167
|
+
const unsigned char *ct, unsigned long ctlen,
|
|
168
|
+
unsigned char *pt,
|
|
169
|
+
const unsigned char *tag, unsigned long taglen, int *stat);
|
|
170
|
+
|
|
171
|
+
int ocb_encrypt_authenticate_memory(int cipher,
|
|
172
|
+
const unsigned char *key, unsigned long keylen,
|
|
173
|
+
const unsigned char *nonce,
|
|
174
|
+
const unsigned char *pt, unsigned long ptlen,
|
|
175
|
+
unsigned char *ct,
|
|
176
|
+
unsigned char *tag, unsigned long *taglen);
|
|
177
|
+
|
|
178
|
+
int ocb_decrypt_verify_memory(int cipher,
|
|
179
|
+
const unsigned char *key, unsigned long keylen,
|
|
180
|
+
const unsigned char *nonce,
|
|
181
|
+
const unsigned char *ct, unsigned long ctlen,
|
|
182
|
+
unsigned char *pt,
|
|
183
|
+
const unsigned char *tag, unsigned long taglen,
|
|
184
|
+
int *stat);
|
|
185
|
+
|
|
186
|
+
int ocb_test(void);
|
|
187
|
+
|
|
188
|
+
/* internal functions */
|
|
189
|
+
void ocb_shift_xor(ocb_state *ocb, unsigned char *Z);
|
|
190
|
+
int ocb_ntz(unsigned long x);
|
|
191
|
+
int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
|
|
192
|
+
unsigned char *ct, unsigned char *tag, unsigned long *taglen, int mode);
|
|
193
|
+
|
|
194
|
+
#endif /* LTC_OCB_MODE */
|
|
195
|
+
|
|
196
|
+
#ifdef LTC_OCB3_MODE
|
|
197
|
+
typedef struct {
|
|
198
|
+
unsigned char Offset_0[MAXBLOCKSIZE], /* Offset_0 value */
|
|
199
|
+
Offset_current[MAXBLOCKSIZE], /* Offset_{current_block_index} value */
|
|
200
|
+
L_dollar[MAXBLOCKSIZE], /* L_$ value */
|
|
201
|
+
L_star[MAXBLOCKSIZE], /* L_* value */
|
|
202
|
+
L_[32][MAXBLOCKSIZE], /* L_{i} values */
|
|
203
|
+
tag_part[MAXBLOCKSIZE], /* intermediate result of tag calculation */
|
|
204
|
+
checksum[MAXBLOCKSIZE]; /* current checksum */
|
|
205
|
+
|
|
206
|
+
/* AAD related members */
|
|
207
|
+
unsigned char aSum_current[MAXBLOCKSIZE], /* AAD related helper variable */
|
|
208
|
+
aOffset_current[MAXBLOCKSIZE], /* AAD related helper variable */
|
|
209
|
+
adata_buffer[MAXBLOCKSIZE]; /* AAD buffer */
|
|
210
|
+
int adata_buffer_bytes; /* bytes in AAD buffer */
|
|
211
|
+
unsigned long ablock_index; /* index # for current adata (AAD) block */
|
|
212
|
+
|
|
213
|
+
symmetric_key key; /* scheduled key for cipher */
|
|
214
|
+
unsigned long block_index; /* index # for current data block */
|
|
215
|
+
int cipher, /* cipher idx */
|
|
216
|
+
block_len; /* length of block */
|
|
217
|
+
} ocb3_state;
|
|
218
|
+
|
|
219
|
+
int ocb3_init(ocb3_state *ocb, int cipher,
|
|
220
|
+
const unsigned char *key, unsigned long keylen,
|
|
221
|
+
const unsigned char *nonce, unsigned long noncelen);
|
|
222
|
+
|
|
223
|
+
int ocb3_encrypt(ocb3_state *ocb, const unsigned char *pt, unsigned long ptlen, unsigned char *ct);
|
|
224
|
+
int ocb3_decrypt(ocb3_state *ocb, const unsigned char *ct, unsigned long ctlen, unsigned char *pt);
|
|
225
|
+
int ocb3_encrypt_last(ocb3_state *ocb, const unsigned char *pt, unsigned long ptlen, unsigned char *ct);
|
|
226
|
+
int ocb3_decrypt_last(ocb3_state *ocb, const unsigned char *ct, unsigned long ctlen, unsigned char *pt);
|
|
227
|
+
int ocb3_add_aad(ocb3_state *ocb, const unsigned char *aad, unsigned long aadlen);
|
|
228
|
+
int ocb3_done(ocb3_state *ocb, unsigned char *tag, unsigned long *taglen);
|
|
229
|
+
|
|
230
|
+
int ocb3_encrypt_authenticate_memory(int cipher,
|
|
231
|
+
const unsigned char *key, unsigned long keylen,
|
|
232
|
+
const unsigned char *nonce, unsigned long noncelen,
|
|
233
|
+
const unsigned char *adata, unsigned long adatalen,
|
|
234
|
+
const unsigned char *pt, unsigned long ptlen,
|
|
235
|
+
unsigned char *ct,
|
|
236
|
+
unsigned char *tag, unsigned long *taglen);
|
|
237
|
+
|
|
238
|
+
int ocb3_decrypt_verify_memory(int cipher,
|
|
239
|
+
const unsigned char *key, unsigned long keylen,
|
|
240
|
+
const unsigned char *nonce, unsigned long noncelen,
|
|
241
|
+
const unsigned char *adata, unsigned long adatalen,
|
|
242
|
+
const unsigned char *ct, unsigned long ctlen,
|
|
243
|
+
unsigned char *pt,
|
|
244
|
+
const unsigned char *tag, unsigned long taglen,
|
|
245
|
+
int *stat);
|
|
246
|
+
|
|
247
|
+
int ocb3_test(void);
|
|
248
|
+
|
|
249
|
+
/* internal helper functions */
|
|
250
|
+
int ocb3_int_aad_add_block(ocb3_state *ocb, const unsigned char *aad_block);
|
|
251
|
+
void ocb3_int_calc_offset_zero(ocb3_state *ocb, const unsigned char *nonce, unsigned long noncelen);
|
|
252
|
+
int ocb3_int_ntz(unsigned long x);
|
|
253
|
+
void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len);
|
|
254
|
+
|
|
255
|
+
#endif /* LTC_OCB3_MODE */
|
|
256
|
+
|
|
257
|
+
#ifdef LTC_CCM_MODE
|
|
258
|
+
|
|
259
|
+
#define CCM_ENCRYPT 0
|
|
260
|
+
#define CCM_DECRYPT 1
|
|
261
|
+
|
|
262
|
+
typedef struct {
|
|
263
|
+
symmetric_key K;
|
|
264
|
+
int cipher, /* which cipher */
|
|
265
|
+
taglen, /* length of the tag */
|
|
266
|
+
x; /* index in PAD */
|
|
267
|
+
|
|
268
|
+
unsigned long L, /* L value */
|
|
269
|
+
ptlen, /* length that will be enc / dec */
|
|
270
|
+
current_ptlen, /* current processed length */
|
|
271
|
+
aadlen, /* length of the aad */
|
|
272
|
+
current_aadlen, /* length of the currently provided add */
|
|
273
|
+
noncelen; /* length of the nonce */
|
|
274
|
+
|
|
275
|
+
unsigned char PAD[16],
|
|
276
|
+
ctr[16],
|
|
277
|
+
CTRPAD[16],
|
|
278
|
+
CTRlen;
|
|
279
|
+
} ccm_state;
|
|
280
|
+
|
|
281
|
+
int ccm_init(ccm_state *ccm, int cipher,
|
|
282
|
+
const unsigned char *key, int keylen, int ptlen, int taglen, int aad_len);
|
|
283
|
+
|
|
284
|
+
int ccm_reset(ccm_state *ccm);
|
|
285
|
+
|
|
286
|
+
int ccm_add_nonce(ccm_state *ccm,
|
|
287
|
+
const unsigned char *nonce, unsigned long noncelen);
|
|
288
|
+
|
|
289
|
+
int ccm_add_aad(ccm_state *ccm,
|
|
290
|
+
const unsigned char *adata, unsigned long adatalen);
|
|
291
|
+
|
|
292
|
+
int ccm_process(ccm_state *ccm,
|
|
293
|
+
unsigned char *pt, unsigned long ptlen,
|
|
294
|
+
unsigned char *ct,
|
|
295
|
+
int direction);
|
|
296
|
+
|
|
297
|
+
int ccm_done(ccm_state *ccm,
|
|
298
|
+
unsigned char *tag, unsigned long *taglen);
|
|
299
|
+
|
|
300
|
+
int ccm_memory(int cipher,
|
|
301
|
+
const unsigned char *key, unsigned long keylen,
|
|
302
|
+
symmetric_key *uskey,
|
|
303
|
+
const unsigned char *nonce, unsigned long noncelen,
|
|
304
|
+
const unsigned char *header, unsigned long headerlen,
|
|
305
|
+
unsigned char *pt, unsigned long ptlen,
|
|
306
|
+
unsigned char *ct,
|
|
307
|
+
unsigned char *tag, unsigned long *taglen,
|
|
308
|
+
int direction);
|
|
309
|
+
|
|
310
|
+
int ccm_memory_ex(int cipher,
|
|
311
|
+
const unsigned char *key, unsigned long keylen,
|
|
312
|
+
symmetric_key *uskey,
|
|
313
|
+
const unsigned char *nonce, unsigned long noncelen,
|
|
314
|
+
const unsigned char *header, unsigned long headerlen,
|
|
315
|
+
unsigned char *pt, unsigned long ptlen,
|
|
316
|
+
unsigned char *ct,
|
|
317
|
+
unsigned char *tag, unsigned long *taglen,
|
|
318
|
+
int direction,
|
|
319
|
+
const unsigned char *B_0,
|
|
320
|
+
const unsigned char *CTR,
|
|
321
|
+
int ctrwidth);
|
|
322
|
+
|
|
323
|
+
int ccm_test(void);
|
|
324
|
+
|
|
325
|
+
#endif /* LTC_CCM_MODE */
|
|
326
|
+
|
|
327
|
+
#if defined(LRW_MODE) || defined(LTC_GCM_MODE)
|
|
328
|
+
void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c);
|
|
329
|
+
#endif
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
/* table shared between GCM and LRW */
|
|
333
|
+
#if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST))
|
|
334
|
+
extern const unsigned char gcm_shift_table[];
|
|
335
|
+
#endif
|
|
336
|
+
|
|
337
|
+
#ifdef LTC_GCM_MODE
|
|
338
|
+
|
|
339
|
+
#define GCM_ENCRYPT 0
|
|
340
|
+
#define GCM_DECRYPT 1
|
|
341
|
+
|
|
342
|
+
#define LTC_GCM_MODE_IV 0
|
|
343
|
+
#define LTC_GCM_MODE_AAD 1
|
|
344
|
+
#define LTC_GCM_MODE_TEXT 2
|
|
345
|
+
|
|
346
|
+
typedef struct {
|
|
347
|
+
symmetric_key K;
|
|
348
|
+
unsigned char H[16], /* multiplier */
|
|
349
|
+
X[16], /* accumulator */
|
|
350
|
+
Y[16], /* counter */
|
|
351
|
+
Y_0[16], /* initial counter */
|
|
352
|
+
buf[16]; /* buffer for stuff */
|
|
353
|
+
|
|
354
|
+
int cipher, /* which cipher */
|
|
355
|
+
ivmode, /* Which mode is the IV in? */
|
|
356
|
+
mode, /* mode the GCM code is in */
|
|
357
|
+
buflen; /* length of data in buf */
|
|
358
|
+
|
|
359
|
+
ulong64 totlen, /* 64-bit counter used for IV and AAD */
|
|
360
|
+
pttotlen; /* 64-bit counter for the PT */
|
|
361
|
+
|
|
362
|
+
#ifdef LTC_GCM_TABLES
|
|
363
|
+
unsigned char PC[16][256][16] /* 16 tables of 8x128 */
|
|
364
|
+
#ifdef LTC_GCM_TABLES_SSE2
|
|
365
|
+
__attribute__ ((aligned (16)))
|
|
366
|
+
#endif
|
|
367
|
+
;
|
|
368
|
+
#endif
|
|
369
|
+
} gcm_state;
|
|
370
|
+
|
|
371
|
+
void gcm_mult_h(gcm_state *gcm, unsigned char *I);
|
|
372
|
+
|
|
373
|
+
int gcm_init(gcm_state *gcm, int cipher,
|
|
374
|
+
const unsigned char *key, int keylen);
|
|
375
|
+
|
|
376
|
+
int gcm_reset(gcm_state *gcm);
|
|
377
|
+
|
|
378
|
+
int gcm_add_iv(gcm_state *gcm,
|
|
379
|
+
const unsigned char *IV, unsigned long IVlen);
|
|
380
|
+
|
|
381
|
+
int gcm_add_aad(gcm_state *gcm,
|
|
382
|
+
const unsigned char *adata, unsigned long adatalen);
|
|
383
|
+
|
|
384
|
+
int gcm_process(gcm_state *gcm,
|
|
385
|
+
unsigned char *pt, unsigned long ptlen,
|
|
386
|
+
unsigned char *ct,
|
|
387
|
+
int direction);
|
|
388
|
+
|
|
389
|
+
int gcm_done(gcm_state *gcm,
|
|
390
|
+
unsigned char *tag, unsigned long *taglen);
|
|
391
|
+
|
|
392
|
+
int gcm_memory( int cipher,
|
|
393
|
+
const unsigned char *key, unsigned long keylen,
|
|
394
|
+
const unsigned char *IV, unsigned long IVlen,
|
|
395
|
+
const unsigned char *adata, unsigned long adatalen,
|
|
396
|
+
unsigned char *pt, unsigned long ptlen,
|
|
397
|
+
unsigned char *ct,
|
|
398
|
+
unsigned char *tag, unsigned long *taglen,
|
|
399
|
+
int direction);
|
|
400
|
+
int gcm_test(void);
|
|
401
|
+
|
|
402
|
+
#endif /* LTC_GCM_MODE */
|
|
403
|
+
|
|
404
|
+
#ifdef LTC_PELICAN
|
|
405
|
+
|
|
406
|
+
typedef struct pelican_state
|
|
407
|
+
{
|
|
408
|
+
symmetric_key K;
|
|
409
|
+
unsigned char state[16];
|
|
410
|
+
int buflen;
|
|
411
|
+
} pelican_state;
|
|
412
|
+
|
|
413
|
+
int pelican_init(pelican_state *pelmac, const unsigned char *key, unsigned long keylen);
|
|
414
|
+
int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned long inlen);
|
|
415
|
+
int pelican_done(pelican_state *pelmac, unsigned char *out);
|
|
416
|
+
int pelican_test(void);
|
|
417
|
+
|
|
418
|
+
int pelican_memory(const unsigned char *key, unsigned long keylen,
|
|
419
|
+
const unsigned char *in, unsigned long inlen,
|
|
420
|
+
unsigned char *out);
|
|
421
|
+
|
|
422
|
+
#endif
|
|
423
|
+
|
|
424
|
+
#ifdef LTC_XCBC
|
|
425
|
+
|
|
426
|
+
/* add this to "keylen" to xcbc_init to use a pure three-key XCBC MAC */
|
|
427
|
+
#define LTC_XCBC_PURE 0x8000UL
|
|
428
|
+
|
|
429
|
+
typedef struct {
|
|
430
|
+
unsigned char K[3][MAXBLOCKSIZE],
|
|
431
|
+
IV[MAXBLOCKSIZE];
|
|
432
|
+
|
|
433
|
+
symmetric_key key;
|
|
434
|
+
|
|
435
|
+
int cipher,
|
|
436
|
+
buflen,
|
|
437
|
+
blocksize;
|
|
438
|
+
} xcbc_state;
|
|
439
|
+
|
|
440
|
+
int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned long keylen);
|
|
441
|
+
int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen);
|
|
442
|
+
int xcbc_done(xcbc_state *xcbc, unsigned char *out, unsigned long *outlen);
|
|
443
|
+
int xcbc_memory(int cipher,
|
|
444
|
+
const unsigned char *key, unsigned long keylen,
|
|
445
|
+
const unsigned char *in, unsigned long inlen,
|
|
446
|
+
unsigned char *out, unsigned long *outlen);
|
|
447
|
+
int xcbc_memory_multi(int cipher,
|
|
448
|
+
const unsigned char *key, unsigned long keylen,
|
|
449
|
+
unsigned char *out, unsigned long *outlen,
|
|
450
|
+
const unsigned char *in, unsigned long inlen, ...);
|
|
451
|
+
int xcbc_file(int cipher,
|
|
452
|
+
const unsigned char *key, unsigned long keylen,
|
|
453
|
+
const char *filename,
|
|
454
|
+
unsigned char *out, unsigned long *outlen);
|
|
455
|
+
int xcbc_test(void);
|
|
456
|
+
|
|
457
|
+
#endif
|
|
458
|
+
|
|
459
|
+
#ifdef LTC_F9_MODE
|
|
460
|
+
|
|
461
|
+
typedef struct {
|
|
462
|
+
unsigned char akey[MAXBLOCKSIZE],
|
|
463
|
+
ACC[MAXBLOCKSIZE],
|
|
464
|
+
IV[MAXBLOCKSIZE];
|
|
465
|
+
|
|
466
|
+
symmetric_key key;
|
|
467
|
+
|
|
468
|
+
int cipher,
|
|
469
|
+
buflen,
|
|
470
|
+
keylen,
|
|
471
|
+
blocksize;
|
|
472
|
+
} f9_state;
|
|
473
|
+
|
|
474
|
+
int f9_init(f9_state *f9, int cipher, const unsigned char *key, unsigned long keylen);
|
|
475
|
+
int f9_process(f9_state *f9, const unsigned char *in, unsigned long inlen);
|
|
476
|
+
int f9_done(f9_state *f9, unsigned char *out, unsigned long *outlen);
|
|
477
|
+
int f9_memory(int cipher,
|
|
478
|
+
const unsigned char *key, unsigned long keylen,
|
|
479
|
+
const unsigned char *in, unsigned long inlen,
|
|
480
|
+
unsigned char *out, unsigned long *outlen);
|
|
481
|
+
int f9_memory_multi(int cipher,
|
|
482
|
+
const unsigned char *key, unsigned long keylen,
|
|
483
|
+
unsigned char *out, unsigned long *outlen,
|
|
484
|
+
const unsigned char *in, unsigned long inlen, ...);
|
|
485
|
+
int f9_file(int cipher,
|
|
486
|
+
const unsigned char *key, unsigned long keylen,
|
|
487
|
+
const char *filename,
|
|
488
|
+
unsigned char *out, unsigned long *outlen);
|
|
489
|
+
int f9_test(void);
|
|
490
|
+
|
|
491
|
+
#endif
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
/* $Source$ */
|
|
495
|
+
/* $Revision$ */
|
|
496
|
+
/* $Date$ */
|