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.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef CTR_H
michael@0 6 #define CTR_H 1
michael@0 7
michael@0 8 #include "blapii.h"
michael@0 9
michael@0 10 /* This structure is defined in this header because both ctr.c and gcm.c
michael@0 11 * need it. */
michael@0 12 struct CTRContextStr {
michael@0 13 freeblCipherFunc cipher;
michael@0 14 void *context;
michael@0 15 unsigned char counter[MAX_BLOCK_SIZE];
michael@0 16 unsigned char buffer[MAX_BLOCK_SIZE];
michael@0 17 unsigned long counterBits;
michael@0 18 unsigned int bufPtr;
michael@0 19 };
michael@0 20
michael@0 21 typedef struct CTRContextStr CTRContext;
michael@0 22
michael@0 23 SECStatus CTR_InitContext(CTRContext *ctr, void *context,
michael@0 24 freeblCipherFunc cipher, const unsigned char *param,
michael@0 25 unsigned int blocksize);
michael@0 26
michael@0 27 /*
michael@0 28 * The context argument is the inner cipher context to use with cipher. The
michael@0 29 * CTRContext does not own context. context needs to remain valid for as long
michael@0 30 * as the CTRContext is valid.
michael@0 31 *
michael@0 32 * The cipher argument is a block cipher in the ECB encrypt mode.
michael@0 33 */
michael@0 34 CTRContext * CTR_CreateContext(void *context, freeblCipherFunc cipher,
michael@0 35 const unsigned char *param, unsigned int blocksize);
michael@0 36
michael@0 37 void CTR_DestroyContext(CTRContext *ctr, PRBool freeit);
michael@0 38
michael@0 39 SECStatus CTR_Update(CTRContext *ctr, unsigned char *outbuf,
michael@0 40 unsigned int *outlen, unsigned int maxout,
michael@0 41 const unsigned char *inbuf, unsigned int inlen,
michael@0 42 unsigned int blocksize);
michael@0 43
michael@0 44 #ifdef USE_HW_AES
michael@0 45 SECStatus CTR_Update_HW_AES(CTRContext *ctr, unsigned char *outbuf,
michael@0 46 unsigned int *outlen, unsigned int maxout,
michael@0 47 const unsigned char *inbuf, unsigned int inlen,
michael@0 48 unsigned int blocksize);
michael@0 49 #endif
michael@0 50
michael@0 51 #endif

mercurial