"Fossies" - the Fresh Open Source Software Archive

Member "nss-3.37.3/nss/lib/freebl/alghmac.h" (5 Jun 2018, 1981 Bytes) of package /linux/misc/nss-3.37.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "alghmac.h" see the Fossies "Dox" file reference documentation.

    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/. */
    4 
    5 #ifndef _ALGHMAC_H_
    6 #define _ALGHMAC_H_
    7 
    8 typedef struct HMACContextStr HMACContext;
    9 
   10 SEC_BEGIN_PROTOS
   11 
   12 /* destroy HMAC context */
   13 extern void
   14 HMAC_Destroy(HMACContext *cx, PRBool freeit);
   15 
   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);
   27 
   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);
   32 
   33 /* reset HMAC for a fresh round */
   34 extern void
   35 HMAC_Begin(HMACContext *cx);
   36 
   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);
   44 
   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);
   54 
   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);
   61 
   62 SEC_END_PROTOS
   63 
   64 #endif