~ubuntu-branches/ubuntu/wily/rtmpdump/wily-proposed

« back to all changes in this revision

Viewing changes to librtmp/handshake.h

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2014-04-11 22:08:17 UTC
  • mfrom: (6.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20140411220817-gef1vkyrygbyd87i
Tags: 2.4+20131018.git79459a2-2
Depends on libgmp-dev and nettle-dev to librtmpdev (Closes: #744242)

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#define RC4_free(h)     free(h)
44
44
 
45
45
#elif defined(USE_GNUTLS)
46
 
#include <gcrypt.h>
 
46
#include <nettle/hmac.h>
 
47
#include <nettle/arcfour.h>
47
48
#ifndef SHA256_DIGEST_LENGTH
48
49
#define SHA256_DIGEST_LENGTH    32
49
50
#endif
50
 
#define HMAC_CTX        gcry_md_hd_t
51
 
#define HMAC_setup(ctx, key, len)       gcry_md_open(&ctx, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC); gcry_md_setkey(ctx, key, len)
52
 
#define HMAC_crunch(ctx, buf, len)      gcry_md_write(ctx, buf, len)
53
 
#define HMAC_finish(ctx, dig, dlen)     dlen = SHA256_DIGEST_LENGTH; memcpy(dig, gcry_md_read(ctx, 0), dlen); gcry_md_close(ctx)
 
51
#undef HMAC_CTX
 
52
#define HMAC_CTX        struct hmac_sha256_ctx
 
53
#define HMAC_setup(ctx, key, len)       hmac_sha256_set_key(&ctx, len, key)
 
54
#define HMAC_crunch(ctx, buf, len)      hmac_sha256_update(&ctx, len, buf)
 
55
#define HMAC_finish(ctx, dig, dlen)     dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig)
 
56
#define HMAC_close(ctx)
54
57
 
55
 
typedef gcry_cipher_hd_t        RC4_handle;
56
 
#define RC4_alloc(h)    gcry_cipher_open(h, GCRY_CIPHER_ARCFOUR, GCRY_CIPHER_MODE_STREAM, 0)
57
 
#define RC4_setkey(h,l,k)       gcry_cipher_setkey(h,k,l)
58
 
#define RC4_encrypt(h,l,d)      gcry_cipher_encrypt(h,(void *)d,l,NULL,0)
59
 
#define RC4_encrypt2(h,l,s,d)   gcry_cipher_encrypt(h,(void *)d,l,(void *)s,l)
60
 
#define RC4_free(h)     gcry_cipher_close(h)
 
58
typedef struct arcfour_ctx*     RC4_handle;
 
59
#define RC4_alloc(h)    *h = malloc(sizeof(struct arcfour_ctx))
 
60
#define RC4_setkey(h,l,k)       arcfour_set_key(h, l, k)
 
61
#define RC4_encrypt(h,l,d)      arcfour_crypt(h,l,(uint8_t *)d,(uint8_t *)d)
 
62
#define RC4_encrypt2(h,l,s,d)   arcfour_crypt(h,l,(uint8_t *)d,(uint8_t *)s)
 
63
#define RC4_free(h)     free(h)
61
64
 
62
65
#else   /* USE_OPENSSL */
63
66
#include <openssl/sha.h>