crypto.h

Go to the documentation of this file.
00001 
00028 #ifndef CRYPTO_H
00029 #define CRYPTO_H
00030 
00039 void md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
00040 
00049 void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
00050 
00059 void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len,
00060                  u8 *mac);
00061 
00075 int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen);
00076 
00085 void sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len,
00086                    u8 *mac);
00087 
00095 void des_encrypt(const u8 *clear, const u8 *key, u8 *cypher);
00096 
00104 void * aes_encrypt_init(const u8 *key, size_t len);
00105 
00113 void aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
00114 
00120 void aes_encrypt_deinit(void *ctx);
00121 
00129 void * aes_decrypt_init(const u8 *key, size_t len);
00130 
00138 void aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
00139 
00145 void aes_decrypt_deinit(void *ctx);
00146 
00147 
00148 enum crypto_hash_alg {
00149         CRYPTO_HASH_ALG_MD5, CRYPTO_HASH_ALG_SHA1,
00150         CRYPTO_HASH_ALG_HMAC_MD5, CRYPTO_HASH_ALG_HMAC_SHA1
00151 };
00152 
00153 struct crypto_hash;
00154 
00168 struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
00169                                       size_t key_len);
00170 
00182 void crypto_hash_update(struct crypto_hash *ctx, const u8 *data, size_t len);
00183 
00202 int crypto_hash_finish(struct crypto_hash *ctx, u8 *hash, size_t *len);
00203 
00204 
00205 enum crypto_cipher_alg {
00206         CRYPTO_CIPHER_NULL = 0, CRYPTO_CIPHER_ALG_AES, CRYPTO_CIPHER_ALG_3DES,
00207         CRYPTO_CIPHER_ALG_DES, CRYPTO_CIPHER_ALG_RC2, CRYPTO_CIPHER_ALG_RC4
00208 };
00209 
00210 struct crypto_cipher;
00211 
00226 struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg,
00227                                           const u8 *iv, const u8 *key,
00228                                           size_t key_len);
00229 
00243 int crypto_cipher_encrypt(struct crypto_cipher *ctx, const u8 *plain,
00244                           u8 *crypt, size_t len);
00245 
00259 int crypto_cipher_decrypt(struct crypto_cipher *ctx, const u8 *crypt,
00260                           u8 *plain, size_t len);
00261 
00271 void crypto_cipher_deinit(struct crypto_cipher *ctx);
00272 
00273 
00274 struct crypto_public_key;
00275 struct crypto_private_key;
00276 
00292 struct crypto_public_key * crypto_public_key_import(const u8 *key, size_t len);
00293 
00305 struct crypto_private_key * crypto_private_key_import(const u8 *key,
00306                                                       size_t len);
00307 
00323 struct crypto_public_key * crypto_public_key_from_cert(const u8 *buf,
00324                                                        size_t len);
00325 
00340 int crypto_public_key_encrypt_pkcs1_v15(struct crypto_public_key *key,
00341                                         const u8 *in, size_t inlen,
00342                                         u8 *out, size_t *outlen);
00343 
00358 int crypto_private_key_sign_pkcs1(struct crypto_private_key *key,
00359                                   const u8 *in, size_t inlen,
00360                                   u8 *out, size_t *outlen);
00361 
00371 void crypto_public_key_free(struct crypto_public_key *key);
00372 
00382 void crypto_private_key_free(struct crypto_private_key *key);
00383 
00394 int crypto_public_key_decrypt_pkcs1(struct crypto_public_key *key,
00395                                     const u8 *crypt, size_t crypt_len,
00396                                     u8 *plain, size_t *plain_len);
00397 
00406 int crypto_global_init(void);
00407 
00416 void crypto_global_deinit(void);
00417 
00439 int crypto_mod_exp(const u8 *base, size_t base_len,
00440                    const u8 *power, size_t power_len,
00441                    const u8 *modulus, size_t modulus_len,
00442                    u8 *result, size_t *result_len);
00443 
00444 #endif /* CRYPTO_H */
00445 

Generated on Sun Dec 31 13:43:25 2006 for hostapd by  doxygen 1.4.2