]>
git.saurik.com Git - apple/security.git/blob - AppleCSP/AES/rijndaelApi.h
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 * rijndaelApi.h - AES API layer
22 * Based on rijndael-api-ref.h v2.0 written by Paulo Barreto
26 #ifndef _RIJNDAEL_API_REF_H_
27 #define _RIJNDAEL_API_REF_H_
30 #include "rijndael-alg-ref.h"
37 #define BAD_KEY_MAT -1 /* Key material not of correct
39 #define BAD_KEY_INSTANCE -2 /* Key passed is not valid */
41 #define MAX_AES_KEY_SIZE (MAX_AES_KEY_BITS / 8)
42 #define MAX_AES_BLOCK_SIZE (MAX_AES_BLOCK_BITS / 8)
43 #define MAX_AES_IV_SIZE MAX_AES_BLOCK_SIZE
48 /* The structure for key information */
50 word32 keyLen
; /* Length of the key in bits */
51 word32 blockLen
; /* Length of block in bits */
52 word32 columns
; /* optimization, blockLen / 32 */
53 word8 keySched
[MAXROUNDS
+1][4][MAXBC
];
58 int keyLen
, // in BITS
59 int blockLen
, // in BITS
64 * Simplified single-block encrypt/decrypt.
66 int rijndaelBlockEncrypt(
70 int rijndaelBlockDecrypt(
75 #if !GLADMAN_AES_128_ENABLE
77 * Optimized routines for 128 bit block and 128 bit key.
79 int rijndaelBlockEncrypt128(
83 int rijndaelBlockDecrypt128(
87 #endif /* !GLADMAN_AES_128_ENABLE */
89 #if defined(__ppc__) && defined(ALTIVEC_ENABLE)
91 * dmitch addenda 4/11/2001: 128-bit only vectorized encrypt/decrypt with no CBC
93 void vBlockEncrypt128(
97 void vBlockDecrypt128(
102 /* temp switch for runtime enable/disable */
105 #endif /* __ppc__ && ALTIVEC_ENABLE */
107 /* ptr to one of several (possibly optimized) encrypt/decrypt functions */
108 typedef int (*aesCryptFcn
)(
117 #endif // RIJNDAEL_API_REF