00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef WRAPPER_H_
00022 #define WRAPPER_H_
00023
00024 #include "config.h"
00025 #include "libssh/libcrypto.h"
00026 #include "libssh/libgcrypt.h"
00027
00028 enum ssh_mac_e {
00029 SSH_MAC_SHA1=1,
00030 SSH_MAC_SHA256,
00031 SSH_MAC_SHA384,
00032 SSH_MAC_SHA512
00033 };
00034
00035 enum ssh_hmac_e {
00036 SSH_HMAC_SHA1 = 1,
00037 SSH_HMAC_MD5
00038 };
00039
00040 enum ssh_des_e {
00041 SSH_3DES,
00042 SSH_DES
00043 };
00044
00045 typedef struct ssh_mac_ctx_struct *ssh_mac_ctx;
00046 MD5CTX md5_init(void);
00047 void md5_update(MD5CTX c, const void *data, unsigned long len);
00048 void md5_final(unsigned char *md,MD5CTX c);
00049 SHACTX sha1_init(void);
00050 void sha1_update(SHACTX c, const void *data, unsigned long len);
00051 void sha1_final(unsigned char *md,SHACTX c);
00052 void sha1(unsigned char *digest,int len,unsigned char *hash);
00053 void sha256(unsigned char *digest, int len, unsigned char *hash);
00054
00055 void evp(int nid, unsigned char *digest, int len, unsigned char *hash, unsigned int *hlen);
00056 EVPCTX evp_init(int nid);
00057 void evp_update(EVPCTX ctx, const void *data, unsigned long len);
00058 void evp_final(EVPCTX ctx, unsigned char *md, unsigned int *mdlen);
00059
00060 ssh_mac_ctx ssh_mac_ctx_init(enum ssh_mac_e type);
00061 void ssh_mac_update(ssh_mac_ctx ctx, const void *data, unsigned long len);
00062 void ssh_mac_final(unsigned char *md, ssh_mac_ctx ctx);
00063
00064 HMACCTX hmac_init(const void *key,int len, enum ssh_hmac_e type);
00065 void hmac_update(HMACCTX c, const void *data, unsigned long len);
00066 void hmac_final(HMACCTX ctx,unsigned char *hashmacbuf,unsigned int *len);
00067
00068 int crypt_set_algorithms(ssh_session session, enum ssh_des_e des_type);
00069 int crypt_set_algorithms_server(ssh_session session);
00070 struct ssh_crypto_struct *crypto_new(void);
00071 void crypto_free(struct ssh_crypto_struct *crypto);
00072
00073 void ssh_reseed(void);
00074
00075 #endif