diff options
Diffstat (limited to 'libs/libssh2/src/crypto.h')
-rw-r--r-- | libs/libssh2/src/crypto.h | 94 |
1 files changed, 25 insertions, 69 deletions
diff --git a/libs/libssh2/src/crypto.h b/libs/libssh2/src/crypto.h index 561cd96e2b..487444145d 100644 --- a/libs/libssh2/src/crypto.h +++ b/libs/libssh2/src/crypto.h @@ -1,5 +1,5 @@ -#ifndef __LIBSSH2_CRYPTO_H -#define __LIBSSH2_CRYPTO_H +#ifndef LIBSSH2_CRYPTO_H +#define LIBSSH2_CRYPTO_H /* Copyright (C) Simon Josefsson * Copyright (C) The Written Word, Inc. * Copyright (C) Daniel Stenberg @@ -55,70 +55,26 @@ #error "no cryptography backend selected" #endif -#ifdef LIBSSH2_NO_MD5 -#undef LIBSSH2_MD5 -#define LIBSSH2_MD5 0 +/* return: success = 1, error = 0 */ +int _libssh2_hmac_ctx_init(libssh2_hmac_ctx *ctx); +#if LIBSSH2_MD5 +int _libssh2_hmac_md5_init(libssh2_hmac_ctx *ctx, + void *key, size_t keylen); #endif - -#ifdef LIBSSH2_NO_HMAC_RIPEMD -#undef LIBSSH2_HMAC_RIPEMD -#define LIBSSH2_HMAC_RIPEMD 0 -#endif - -#ifdef LIBSSH2_NO_DSA -#undef LIBSSH2_DSA -#define LIBSSH2_DSA 0 -#endif - -#ifdef LIBSSH2_NO_RSA -#undef LIBSSH2_RSA -#define LIBSSH2_RSA 0 -#endif - -#ifdef LIBSSH2_NO_RSA_SHA1 -#undef LIBSSH2_RSA_SHA1 -#define LIBSSH2_RSA_SHA1 0 -#endif - -#ifdef LIBSSH2_NO_ECDSA -#undef LIBSSH2_ECDSA -#define LIBSSH2_ECDSA 0 -#endif - -#ifdef LIBSSH2_NO_ED25519 -#undef LIBSSH2_ED25519 -#define LIBSSH2_ED25519 0 -#endif - -#ifdef LIBSSH2_NO_AES_CTR -#undef LIBSSH2_AES_CTR -#define LIBSSH2_AES_CTR 0 -#endif - -#ifdef LIBSSH2_NO_AES_CBC -#undef LIBSSH2_AES_CBC -#define LIBSSH2_AES_CBC 0 -#endif - -#ifdef LIBSSH2_NO_BLOWFISH -#undef LIBSSH2_BLOWFISH -#define LIBSSH2_BLOWFISH 0 -#endif - -#ifdef LIBSSH2_NO_RC4 -#undef LIBSSH2_RC4 -#define LIBSSH2_RC4 0 -#endif - -#ifdef LIBSSH2_NO_CAST -#undef LIBSSH2_CAST -#define LIBSSH2_CAST 0 -#endif - -#ifdef LIBSSH2_NO_3DES -#undef LIBSSH2_3DES -#define LIBSSH2_3DES 0 +#if LIBSSH2_HMAC_RIPEMD +int _libssh2_hmac_ripemd160_init(libssh2_hmac_ctx *ctx, + void *key, size_t keylen); #endif +int _libssh2_hmac_sha1_init(libssh2_hmac_ctx *ctx, + void *key, size_t keylen); +int _libssh2_hmac_sha256_init(libssh2_hmac_ctx *ctx, + void *key, size_t keylen); +int _libssh2_hmac_sha512_init(libssh2_hmac_ctx *ctx, + void *key, size_t keylen); +int _libssh2_hmac_update(libssh2_hmac_ctx *ctx, + const void *data, size_t datalen); +int _libssh2_hmac_final(libssh2_hmac_ctx *ctx, void *data); +void _libssh2_hmac_cleanup(libssh2_hmac_ctx *ctx); #define LIBSSH2_ED25519_KEY_LEN 32 #define LIBSSH2_ED25519_PRIVATE_KEY_LEN 64 @@ -146,16 +102,16 @@ int _libssh2_rsa_new_private(libssh2_rsa_ctx ** rsa, const char *filename, unsigned const char *passphrase); #if LIBSSH2_RSA_SHA1 -int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx * rsa, - const unsigned char *sig, - size_t sig_len, - const unsigned char *m, size_t m_len); int _libssh2_rsa_sha1_sign(LIBSSH2_SESSION * session, libssh2_rsa_ctx * rsactx, const unsigned char *hash, size_t hash_len, unsigned char **signature, size_t *signature_len); +int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx * rsa, + const unsigned char *sig, + size_t sig_len, + const unsigned char *m, size_t m_len); #endif #if LIBSSH2_RSA_SHA2 int _libssh2_rsa_sha2_sign(LIBSSH2_SESSION * session, @@ -398,4 +354,4 @@ _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session, unsigned char *key_method, size_t key_method_len); -#endif /* __LIBSSH2_CRYPTO_H */ +#endif /* LIBSSH2_CRYPTO_H */ |