security/nss/lib/freebl/ctr.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 CTR_H
     6 #define CTR_H 1
     8 #include "blapii.h"
    10 /* This structure is defined in this header because both ctr.c and gcm.c
    11  * need it. */
    12 struct CTRContextStr {
    13    freeblCipherFunc cipher;
    14    void *context;
    15    unsigned char counter[MAX_BLOCK_SIZE];
    16    unsigned char buffer[MAX_BLOCK_SIZE];
    17    unsigned long counterBits;
    18    unsigned int bufPtr;
    19 };
    21 typedef struct CTRContextStr CTRContext;
    23 SECStatus CTR_InitContext(CTRContext *ctr, void *context,
    24 			freeblCipherFunc cipher, const unsigned char *param,
    25 			unsigned int blocksize);
    27 /*
    28  * The context argument is the inner cipher context to use with cipher. The
    29  * CTRContext does not own context. context needs to remain valid for as long
    30  * as the CTRContext is valid.
    31  *
    32  * The cipher argument is a block cipher in the ECB encrypt mode.
    33  */
    34 CTRContext * CTR_CreateContext(void *context, freeblCipherFunc cipher,
    35 			const unsigned char *param, unsigned int blocksize);
    37 void CTR_DestroyContext(CTRContext *ctr, PRBool freeit);
    39 SECStatus CTR_Update(CTRContext *ctr, unsigned char *outbuf,
    40 			unsigned int *outlen, unsigned int maxout,
    41 			const unsigned char *inbuf, unsigned int inlen,
    42 			unsigned int blocksize);
    44 #ifdef USE_HW_AES
    45 SECStatus CTR_Update_HW_AES(CTRContext *ctr, unsigned char *outbuf,
    46 			unsigned int *outlen, unsigned int maxout,
    47 			const unsigned char *inbuf, unsigned int inlen,
    48 			unsigned int blocksize);
    49 #endif
    51 #endif

mercurial