security/nss/lib/freebl/alghmac.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef _ALGHMAC_H_
     6 #define _ALGHMAC_H_
     8 typedef struct HMACContextStr HMACContext;
    10 SEC_BEGIN_PROTOS
    12 /* destroy HMAC context */
    13 extern void
    14 HMAC_Destroy(HMACContext *cx, PRBool freeit);
    16 /* create HMAC context
    17  *  hash_obj    hash object from SECRawHashObjects[]
    18  *  secret	the secret with which the HMAC is performed.
    19  *  secret_len	the length of the secret.
    20  *  isFIPS	true if conforming to FIPS 198.
    21  *
    22  * NULL is returned if an error occurs.
    23  */
    24 extern HMACContext *
    25 HMAC_Create(const SECHashObject *hash_obj, const unsigned char *secret, 
    26 	    unsigned int secret_len, PRBool isFIPS);
    28 /* like HMAC_Create, except caller allocates HMACContext. */
    29 SECStatus
    30 HMAC_Init(HMACContext *cx, const SECHashObject *hash_obj, 
    31 	  const unsigned char *secret, unsigned int secret_len, PRBool isFIPS);
    33 /* reset HMAC for a fresh round */
    34 extern void
    35 HMAC_Begin(HMACContext *cx);
    37 /* update HMAC 
    38  *  cx		HMAC Context
    39  *  data	the data to perform HMAC on
    40  *  data_len	the length of the data to process
    41  */
    42 extern void 
    43 HMAC_Update(HMACContext *cx, const unsigned char *data, unsigned int data_len);
    45 /* Finish HMAC -- place the results within result
    46  *  cx		HMAC context
    47  *  result	buffer for resulting hmac'd data
    48  *  result_len	where the resultant hmac length is stored
    49  *  max_result_len  maximum possible length that can be stored in result
    50  */
    51 extern SECStatus
    52 HMAC_Finish(HMACContext *cx, unsigned char *result, unsigned int *result_len,
    53 	    unsigned int max_result_len);
    55 /* clone a copy of the HMAC state.  this is usefult when you would
    56  * need to keep a running hmac but also need to extract portions 
    57  * partway through the process.
    58  */
    59 extern HMACContext *
    60 HMAC_Clone(HMACContext *cx);
    62 SEC_END_PROTOS
    64 #endif

mercurial