Ignore:
Timestamp:
May 11, 2007 10:37:14 AM (17 years ago)
Author:
bennylp
Message:

Fixed missing padding when calculating MESSAGE-INTEGRITY in STUN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/include/pjlib-util/hmac_sha1.h

    r1001 r1265  
    2626 
    2727#include <pj/types.h> 
     28#include <pjlib-util/sha1.h> 
    2829 
    2930PJ_BEGIN_DECL 
     
    3536 * 
    3637 * This module contains the implementation of HMAC: Keyed-Hashing  
    37  * for Message Authentication, as described in RFC 2104 
     38 * for Message Authentication, as described in RFC 2104. 
    3839 */ 
     40 
     41/** 
     42 * The HMAC-SHA1 context used in the incremental HMAC calculation. 
     43 */ 
     44typedef struct pj_hmac_sha1_context 
     45{ 
     46    pj_sha1_context context;    /**< SHA1 context           */ 
     47    pj_uint8_t      k_opad[64]; /**< opad xor-ed with key   */ 
     48} pj_hmac_sha1_context; 
    3949 
    4050 
    4151/** 
    42  * Calculate HMAC SHA1 digest for the specified input and key. 
     52 * Calculate HMAC-SHA1 digest for the specified input and key with this 
     53 * single function call. 
    4354 * 
    4455 * @param input         Pointer to the input stream. 
     
    5465 
    5566/** 
     67 * Initiate HMAC-SHA1 context for incremental hashing. 
     68 * 
     69 * @param hctx          HMAC-SHA1 context. 
     70 * @param key           Pointer to the authentication key. 
     71 * @param key_len       Length of the authentication key. 
     72 */ 
     73PJ_DECL(void) pj_hmac_sha1_init(pj_hmac_sha1_context *hctx,  
     74                                const pj_uint8_t *key, unsigned key_len); 
     75 
     76/** 
     77 * Append string to the message. 
     78 * 
     79 * @param hctx          HMAC-SHA1 context. 
     80 * @param input         Pointer to the input stream. 
     81 * @param input_len     Length of input stream in bytes. 
     82 */ 
     83PJ_DECL(void) pj_hmac_sha1_update(pj_hmac_sha1_context *hctx, 
     84                                  const pj_uint8_t *input,  
     85                                  unsigned input_len); 
     86 
     87/** 
     88 * Finish the message and return the digest.  
     89 * 
     90 * @param hctx          HMAC-SHA1 context. 
     91 * @param digest        Buffer to be filled with HMAC SHA1 digest. 
     92 */ 
     93PJ_DECL(void) pj_hmac_sha1_final(pj_hmac_sha1_context *hctx, 
     94                                 pj_uint8_t digest[20]); 
     95 
     96 
     97/** 
    5698 * @} 
    5799 */ 
Note: See TracChangeset for help on using the changeset viewer.