1 /* 2 * blapit.h - public data structures for the crypto library 3 * 4 * ***** BEGIN LICENSE BLOCK ***** 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 6 * 7 * The contents of this file are subject to the Mozilla Public License Version 8 * 1.1 (the "License"); you may not use this file except in compliance with 9 * the License. You may obtain a copy of the License at 10 * http://www.mozilla.org/MPL/ 11 * 12 * Software distributed under the License is distributed on an "AS IS" basis, 13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 * for the specific language governing rights and limitations under the 15 * License. 16 * 17 * The Original Code is the Netscape security libraries. 18 * 19 * The Initial Developer of the Original Code is 20 * Netscape Communications Corporation. 21 * Portions created by the Initial Developer are Copyright (C) 1994-2000 22 * the Initial Developer. All Rights Reserved. 23 * 24 * Contributor(s): 25 * Dr Vipul Gupta <vipul.gupta@sun.com> and 26 * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories 27 * 28 * Alternatively, the contents of this file may be used under the terms of 29 * either the GNU General Public License Version 2 or later (the "GPL"), or 30 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 31 * in which case the provisions of the GPL or the LGPL are applicable instead 32 * of those above. If you wish to allow use of your version of this file only 33 * under the terms of either the GPL or the LGPL, and not to allow others to 34 * use your version of this file under the terms of the MPL, indicate your 35 * decision by deleting the provisions above and replace them with the notice 36 * and other provisions required by the GPL or the LGPL. If you do not delete 37 * the provisions above, a recipient may use your version of this file under 38 * the terms of any one of the MPL, the GPL or the LGPL. 39 * 40 * ***** END LICENSE BLOCK ***** */ 41 /* $Id: blapit.h,v 1.20 2007/02/28 19:47:37 rrelyea%redhat.com Exp $ */ 42 43 #ifndef _BLAPIT_H_ 44 #define _BLAPIT_H_ 45 46 #include "base/third_party/nspr/prtypes.h" 47 48 /* 49 ** A status code. Status's are used by procedures that return status 50 ** values. Again the motivation is so that a compiler can generate 51 ** warnings when return values are wrong. Correct testing of status codes: 52 ** 53 ** SECStatus rv; 54 ** rv = some_function (some_argument); 55 ** if (rv != SECSuccess) 56 ** do_an_error_thing(); 57 ** 58 */ 59 typedef enum _SECStatus { 60 SECWouldBlock = -2, 61 SECFailure = -1, 62 SECSuccess = 0 63 } SECStatus; 64 65 #define SHA256_LENGTH 32 /* bytes */ 66 #define SHA384_LENGTH 48 /* bytes */ 67 #define SHA512_LENGTH 64 /* bytes */ 68 #define HASH_LENGTH_MAX SHA512_LENGTH 69 70 /* 71 * Input block size for each hash algorithm. 72 */ 73 74 #define SHA256_BLOCK_LENGTH 64 /* bytes */ 75 #define SHA384_BLOCK_LENGTH 128 /* bytes */ 76 #define SHA512_BLOCK_LENGTH 128 /* bytes */ 77 #define HASH_BLOCK_LENGTH_MAX SHA512_BLOCK_LENGTH 78 79 /*************************************************************************** 80 ** Opaque objects 81 */ 82 83 struct SHA256ContextStr ; 84 struct SHA512ContextStr ; 85 86 typedef struct SHA256ContextStr SHA256Context; 87 typedef struct SHA512ContextStr SHA512Context; 88 /* SHA384Context is really a SHA512ContextStr. This is not a mistake. */ 89 typedef struct SHA512ContextStr SHA384Context; 90 91 #endif /* _BLAPIT_H_ */ 92