15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * blapit.h - public data structures for the crypto library 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * ***** BEGIN LICENSE BLOCK ***** 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Version: MPL 1.1/GPL 2.0/LGPL 2.1 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The contents of this file are subject to the Mozilla Public License Version 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1.1 (the "License"); you may not use this file except in compliance with 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the License. You may obtain a copy of the License at 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * http://www.mozilla.org/MPL/ 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Software distributed under the License is distributed on an "AS IS" basis, 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * for the specific language governing rights and limitations under the 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * License. 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The Original Code is the Netscape security libraries. 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The Initial Developer of the Original Code is 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Netscape Communications Corporation. 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Portions created by the Initial Developer are Copyright (C) 1994-2000 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the Initial Developer. All Rights Reserved. 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Contributor(s): 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Dr Vipul Gupta <vipul.gupta@sun.com> and 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Alternatively, the contents of this file may be used under the terms of 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * either the GNU General Public License Version 2 or later (the "GPL"), or 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * in which case the provisions of the GPL or the LGPL are applicable instead 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * of those above. If you wish to allow use of your version of this file only 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * under the terms of either the GPL or the LGPL, and not to allow others to 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * use your version of this file under the terms of the MPL, indicate your 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * decision by deleting the provisions above and replace them with the notice 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * and other provisions required by the GPL or the LGPL. If you do not delete 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the provisions above, a recipient may use your version of this file under 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the terms of any one of the MPL, the GPL or the LGPL. 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * ***** END LICENSE BLOCK ***** */ 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* $Id: blapit.h,v 1.20 2007/02/28 19:47:37 rrelyea%redhat.com Exp $ */ 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CRYPTO_THIRD_PARTY_NSS_CHROMIUM_BLAPIT_H_ 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CRYPTO_THIRD_PARTY_NSS_CHROMIUM_BLAPIT_H_ 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 46effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "crypto/third_party/nss/chromium-prtypes.h" 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** A status code. Status's are used by procedures that return status 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** values. Again the motivation is so that a compiler can generate 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** warnings when return values are wrong. Correct testing of status codes: 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** SECStatus rv; 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** rv = some_function (some_argument); 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** if (rv != SECSuccess) 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** do_an_error_thing(); 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef enum _SECStatus { 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SECWouldBlock = -2, 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SECFailure = -1, 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SECSuccess = 0 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} SECStatus; 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SHA256_LENGTH 32 /* bytes */ 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SHA384_LENGTH 48 /* bytes */ 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SHA512_LENGTH 64 /* bytes */ 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define HASH_LENGTH_MAX SHA512_LENGTH 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Input block size for each hash algorithm. 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SHA256_BLOCK_LENGTH 64 /* bytes */ 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SHA384_BLOCK_LENGTH 128 /* bytes */ 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SHA512_BLOCK_LENGTH 128 /* bytes */ 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define HASH_BLOCK_LENGTH_MAX SHA512_BLOCK_LENGTH 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*************************************************************************** 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Opaque objects 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct SHA256ContextStr ; 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct SHA512ContextStr ; 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct SHA256ContextStr SHA256Context; 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct SHA512ContextStr SHA512Context; 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* SHA384Context is really a SHA512ContextStr. This is not a mistake. */ 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct SHA512ContextStr SHA384Context; 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif /* CRYPTO_THIRD_PARTY_NSS_CHROMIUM_BLAPIT_H_ */ 92