Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * loader.h - load platform dependent DSO containing freebl implementation. |
michael@0 | 3 | * |
michael@0 | 4 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef _LOADER_H_ |
michael@0 | 9 | #define _LOADER_H_ 1 |
michael@0 | 10 | |
michael@0 | 11 | #include "blapi.h" |
michael@0 | 12 | |
michael@0 | 13 | #define FREEBL_VERSION 0x0311 |
michael@0 | 14 | |
michael@0 | 15 | struct FREEBLVectorStr { |
michael@0 | 16 | |
michael@0 | 17 | unsigned short length; /* of this struct in bytes */ |
michael@0 | 18 | unsigned short version; /* of this struct. */ |
michael@0 | 19 | |
michael@0 | 20 | RSAPrivateKey * (* p_RSA_NewKey)(int keySizeInBits, |
michael@0 | 21 | SECItem * publicExponent); |
michael@0 | 22 | |
michael@0 | 23 | SECStatus (* p_RSA_PublicKeyOp) (RSAPublicKey * key, |
michael@0 | 24 | unsigned char * output, |
michael@0 | 25 | const unsigned char * input); |
michael@0 | 26 | |
michael@0 | 27 | SECStatus (* p_RSA_PrivateKeyOp)(RSAPrivateKey * key, |
michael@0 | 28 | unsigned char * output, |
michael@0 | 29 | const unsigned char * input); |
michael@0 | 30 | |
michael@0 | 31 | SECStatus (* p_DSA_NewKey)(const PQGParams * params, |
michael@0 | 32 | DSAPrivateKey ** privKey); |
michael@0 | 33 | |
michael@0 | 34 | SECStatus (* p_DSA_SignDigest)(DSAPrivateKey * key, |
michael@0 | 35 | SECItem * signature, |
michael@0 | 36 | const SECItem * digest); |
michael@0 | 37 | |
michael@0 | 38 | SECStatus (* p_DSA_VerifyDigest)(DSAPublicKey * key, |
michael@0 | 39 | const SECItem * signature, |
michael@0 | 40 | const SECItem * digest); |
michael@0 | 41 | |
michael@0 | 42 | SECStatus (* p_DSA_NewKeyFromSeed)(const PQGParams *params, |
michael@0 | 43 | const unsigned char * seed, |
michael@0 | 44 | DSAPrivateKey **privKey); |
michael@0 | 45 | |
michael@0 | 46 | SECStatus (* p_DSA_SignDigestWithSeed)(DSAPrivateKey * key, |
michael@0 | 47 | SECItem * signature, |
michael@0 | 48 | const SECItem * digest, |
michael@0 | 49 | const unsigned char * seed); |
michael@0 | 50 | |
michael@0 | 51 | SECStatus (* p_DH_GenParam)(int primeLen, DHParams ** params); |
michael@0 | 52 | |
michael@0 | 53 | SECStatus (* p_DH_NewKey)(DHParams * params, |
michael@0 | 54 | DHPrivateKey ** privKey); |
michael@0 | 55 | |
michael@0 | 56 | SECStatus (* p_DH_Derive)(SECItem * publicValue, |
michael@0 | 57 | SECItem * prime, |
michael@0 | 58 | SECItem * privateValue, |
michael@0 | 59 | SECItem * derivedSecret, |
michael@0 | 60 | unsigned int maxOutBytes); |
michael@0 | 61 | |
michael@0 | 62 | SECStatus (* p_KEA_Derive)(SECItem *prime, |
michael@0 | 63 | SECItem *public1, |
michael@0 | 64 | SECItem *public2, |
michael@0 | 65 | SECItem *private1, |
michael@0 | 66 | SECItem *private2, |
michael@0 | 67 | SECItem *derivedSecret); |
michael@0 | 68 | |
michael@0 | 69 | PRBool (* p_KEA_Verify)(SECItem *Y, SECItem *prime, SECItem *subPrime); |
michael@0 | 70 | |
michael@0 | 71 | RC4Context * (* p_RC4_CreateContext)(const unsigned char *key, int len); |
michael@0 | 72 | |
michael@0 | 73 | void (* p_RC4_DestroyContext)(RC4Context *cx, PRBool freeit); |
michael@0 | 74 | |
michael@0 | 75 | SECStatus (* p_RC4_Encrypt)(RC4Context *cx, unsigned char *output, |
michael@0 | 76 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 77 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 78 | |
michael@0 | 79 | SECStatus (* p_RC4_Decrypt)(RC4Context *cx, unsigned char *output, |
michael@0 | 80 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 81 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 82 | |
michael@0 | 83 | RC2Context * (* p_RC2_CreateContext)(const unsigned char *key, |
michael@0 | 84 | unsigned int len, const unsigned char *iv, |
michael@0 | 85 | int mode, unsigned effectiveKeyLen); |
michael@0 | 86 | |
michael@0 | 87 | void (* p_RC2_DestroyContext)(RC2Context *cx, PRBool freeit); |
michael@0 | 88 | |
michael@0 | 89 | SECStatus (* p_RC2_Encrypt)(RC2Context *cx, unsigned char *output, |
michael@0 | 90 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 91 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 92 | |
michael@0 | 93 | SECStatus (* p_RC2_Decrypt)(RC2Context *cx, unsigned char *output, |
michael@0 | 94 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 95 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 96 | |
michael@0 | 97 | RC5Context *(* p_RC5_CreateContext)(const SECItem *key, unsigned int rounds, |
michael@0 | 98 | unsigned int wordSize, const unsigned char *iv, int mode); |
michael@0 | 99 | |
michael@0 | 100 | void (* p_RC5_DestroyContext)(RC5Context *cx, PRBool freeit); |
michael@0 | 101 | |
michael@0 | 102 | SECStatus (* p_RC5_Encrypt)(RC5Context *cx, unsigned char *output, |
michael@0 | 103 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 104 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 105 | |
michael@0 | 106 | SECStatus (* p_RC5_Decrypt)(RC5Context *cx, unsigned char *output, |
michael@0 | 107 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 108 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 109 | |
michael@0 | 110 | DESContext *(* p_DES_CreateContext)(const unsigned char *key, |
michael@0 | 111 | const unsigned char *iv, |
michael@0 | 112 | int mode, PRBool encrypt); |
michael@0 | 113 | |
michael@0 | 114 | void (* p_DES_DestroyContext)(DESContext *cx, PRBool freeit); |
michael@0 | 115 | |
michael@0 | 116 | SECStatus (* p_DES_Encrypt)(DESContext *cx, unsigned char *output, |
michael@0 | 117 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 118 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 119 | |
michael@0 | 120 | SECStatus (* p_DES_Decrypt)(DESContext *cx, unsigned char *output, |
michael@0 | 121 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 122 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 123 | |
michael@0 | 124 | AESContext * (* p_AES_CreateContext)(const unsigned char *key, |
michael@0 | 125 | const unsigned char *iv, |
michael@0 | 126 | int mode, int encrypt, unsigned int keylen, |
michael@0 | 127 | unsigned int blocklen); |
michael@0 | 128 | |
michael@0 | 129 | void (* p_AES_DestroyContext)(AESContext *cx, PRBool freeit); |
michael@0 | 130 | |
michael@0 | 131 | SECStatus (* p_AES_Encrypt)(AESContext *cx, unsigned char *output, |
michael@0 | 132 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 133 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 134 | |
michael@0 | 135 | SECStatus (* p_AES_Decrypt)(AESContext *cx, unsigned char *output, |
michael@0 | 136 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 137 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 138 | |
michael@0 | 139 | SECStatus (* p_MD5_Hash)(unsigned char *dest, const char *src); |
michael@0 | 140 | |
michael@0 | 141 | SECStatus (* p_MD5_HashBuf)(unsigned char *dest, const unsigned char *src, |
michael@0 | 142 | PRUint32 src_length); |
michael@0 | 143 | |
michael@0 | 144 | MD5Context *(* p_MD5_NewContext)(void); |
michael@0 | 145 | |
michael@0 | 146 | void (* p_MD5_DestroyContext)(MD5Context *cx, PRBool freeit); |
michael@0 | 147 | |
michael@0 | 148 | void (* p_MD5_Begin)(MD5Context *cx); |
michael@0 | 149 | |
michael@0 | 150 | void (* p_MD5_Update)(MD5Context *cx, |
michael@0 | 151 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 152 | |
michael@0 | 153 | void (* p_MD5_End)(MD5Context *cx, unsigned char *digest, |
michael@0 | 154 | unsigned int *digestLen, unsigned int maxDigestLen); |
michael@0 | 155 | |
michael@0 | 156 | unsigned int (* p_MD5_FlattenSize)(MD5Context *cx); |
michael@0 | 157 | |
michael@0 | 158 | SECStatus (* p_MD5_Flatten)(MD5Context *cx,unsigned char *space); |
michael@0 | 159 | |
michael@0 | 160 | MD5Context * (* p_MD5_Resurrect)(unsigned char *space, void *arg); |
michael@0 | 161 | |
michael@0 | 162 | void (* p_MD5_TraceState)(MD5Context *cx); |
michael@0 | 163 | |
michael@0 | 164 | SECStatus (* p_MD2_Hash)(unsigned char *dest, const char *src); |
michael@0 | 165 | |
michael@0 | 166 | MD2Context *(* p_MD2_NewContext)(void); |
michael@0 | 167 | |
michael@0 | 168 | void (* p_MD2_DestroyContext)(MD2Context *cx, PRBool freeit); |
michael@0 | 169 | |
michael@0 | 170 | void (* p_MD2_Begin)(MD2Context *cx); |
michael@0 | 171 | |
michael@0 | 172 | void (* p_MD2_Update)(MD2Context *cx, |
michael@0 | 173 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 174 | |
michael@0 | 175 | void (* p_MD2_End)(MD2Context *cx, unsigned char *digest, |
michael@0 | 176 | unsigned int *digestLen, unsigned int maxDigestLen); |
michael@0 | 177 | |
michael@0 | 178 | unsigned int (* p_MD2_FlattenSize)(MD2Context *cx); |
michael@0 | 179 | |
michael@0 | 180 | SECStatus (* p_MD2_Flatten)(MD2Context *cx,unsigned char *space); |
michael@0 | 181 | |
michael@0 | 182 | MD2Context * (* p_MD2_Resurrect)(unsigned char *space, void *arg); |
michael@0 | 183 | |
michael@0 | 184 | SECStatus (* p_SHA1_Hash)(unsigned char *dest, const char *src); |
michael@0 | 185 | |
michael@0 | 186 | SECStatus (* p_SHA1_HashBuf)(unsigned char *dest, const unsigned char *src, |
michael@0 | 187 | PRUint32 src_length); |
michael@0 | 188 | |
michael@0 | 189 | SHA1Context *(* p_SHA1_NewContext)(void); |
michael@0 | 190 | |
michael@0 | 191 | void (* p_SHA1_DestroyContext)(SHA1Context *cx, PRBool freeit); |
michael@0 | 192 | |
michael@0 | 193 | void (* p_SHA1_Begin)(SHA1Context *cx); |
michael@0 | 194 | |
michael@0 | 195 | void (* p_SHA1_Update)(SHA1Context *cx, const unsigned char *input, |
michael@0 | 196 | unsigned int inputLen); |
michael@0 | 197 | |
michael@0 | 198 | void (* p_SHA1_End)(SHA1Context *cx, unsigned char *digest, |
michael@0 | 199 | unsigned int *digestLen, unsigned int maxDigestLen); |
michael@0 | 200 | |
michael@0 | 201 | void (* p_SHA1_TraceState)(SHA1Context *cx); |
michael@0 | 202 | |
michael@0 | 203 | unsigned int (* p_SHA1_FlattenSize)(SHA1Context *cx); |
michael@0 | 204 | |
michael@0 | 205 | SECStatus (* p_SHA1_Flatten)(SHA1Context *cx,unsigned char *space); |
michael@0 | 206 | |
michael@0 | 207 | SHA1Context * (* p_SHA1_Resurrect)(unsigned char *space, void *arg); |
michael@0 | 208 | |
michael@0 | 209 | SECStatus (* p_RNG_RNGInit)(void); |
michael@0 | 210 | |
michael@0 | 211 | SECStatus (* p_RNG_RandomUpdate)(const void *data, size_t bytes); |
michael@0 | 212 | |
michael@0 | 213 | SECStatus (* p_RNG_GenerateGlobalRandomBytes)(void *dest, size_t len); |
michael@0 | 214 | |
michael@0 | 215 | void (* p_RNG_RNGShutdown)(void); |
michael@0 | 216 | |
michael@0 | 217 | SECStatus (* p_PQG_ParamGen)(unsigned int j, PQGParams **pParams, |
michael@0 | 218 | PQGVerify **pVfy); |
michael@0 | 219 | |
michael@0 | 220 | SECStatus (* p_PQG_ParamGenSeedLen)( unsigned int j, unsigned int seedBytes, |
michael@0 | 221 | PQGParams **pParams, PQGVerify **pVfy); |
michael@0 | 222 | |
michael@0 | 223 | SECStatus (* p_PQG_VerifyParams)(const PQGParams *params, |
michael@0 | 224 | const PQGVerify *vfy, SECStatus *result); |
michael@0 | 225 | |
michael@0 | 226 | /* Version 3.001 came to here */ |
michael@0 | 227 | |
michael@0 | 228 | SECStatus (* p_RSA_PrivateKeyOpDoubleChecked)(RSAPrivateKey *key, |
michael@0 | 229 | unsigned char *output, |
michael@0 | 230 | const unsigned char *input); |
michael@0 | 231 | |
michael@0 | 232 | SECStatus (* p_RSA_PrivateKeyCheck)(const RSAPrivateKey *key); |
michael@0 | 233 | |
michael@0 | 234 | void (* p_BL_Cleanup)(void); |
michael@0 | 235 | |
michael@0 | 236 | /* Version 3.002 came to here */ |
michael@0 | 237 | |
michael@0 | 238 | SHA256Context *(* p_SHA256_NewContext)(void); |
michael@0 | 239 | void (* p_SHA256_DestroyContext)(SHA256Context *cx, PRBool freeit); |
michael@0 | 240 | void (* p_SHA256_Begin)(SHA256Context *cx); |
michael@0 | 241 | void (* p_SHA256_Update)(SHA256Context *cx, const unsigned char *input, |
michael@0 | 242 | unsigned int inputLen); |
michael@0 | 243 | void (* p_SHA256_End)(SHA256Context *cx, unsigned char *digest, |
michael@0 | 244 | unsigned int *digestLen, unsigned int maxDigestLen); |
michael@0 | 245 | SECStatus (* p_SHA256_HashBuf)(unsigned char *dest, const unsigned char *src, |
michael@0 | 246 | PRUint32 src_length); |
michael@0 | 247 | SECStatus (* p_SHA256_Hash)(unsigned char *dest, const char *src); |
michael@0 | 248 | void (* p_SHA256_TraceState)(SHA256Context *cx); |
michael@0 | 249 | unsigned int (* p_SHA256_FlattenSize)(SHA256Context *cx); |
michael@0 | 250 | SECStatus (* p_SHA256_Flatten)(SHA256Context *cx,unsigned char *space); |
michael@0 | 251 | SHA256Context * (* p_SHA256_Resurrect)(unsigned char *space, void *arg); |
michael@0 | 252 | |
michael@0 | 253 | SHA512Context *(* p_SHA512_NewContext)(void); |
michael@0 | 254 | void (* p_SHA512_DestroyContext)(SHA512Context *cx, PRBool freeit); |
michael@0 | 255 | void (* p_SHA512_Begin)(SHA512Context *cx); |
michael@0 | 256 | void (* p_SHA512_Update)(SHA512Context *cx, const unsigned char *input, |
michael@0 | 257 | unsigned int inputLen); |
michael@0 | 258 | void (* p_SHA512_End)(SHA512Context *cx, unsigned char *digest, |
michael@0 | 259 | unsigned int *digestLen, unsigned int maxDigestLen); |
michael@0 | 260 | SECStatus (* p_SHA512_HashBuf)(unsigned char *dest, const unsigned char *src, |
michael@0 | 261 | PRUint32 src_length); |
michael@0 | 262 | SECStatus (* p_SHA512_Hash)(unsigned char *dest, const char *src); |
michael@0 | 263 | void (* p_SHA512_TraceState)(SHA512Context *cx); |
michael@0 | 264 | unsigned int (* p_SHA512_FlattenSize)(SHA512Context *cx); |
michael@0 | 265 | SECStatus (* p_SHA512_Flatten)(SHA512Context *cx,unsigned char *space); |
michael@0 | 266 | SHA512Context * (* p_SHA512_Resurrect)(unsigned char *space, void *arg); |
michael@0 | 267 | |
michael@0 | 268 | SHA384Context *(* p_SHA384_NewContext)(void); |
michael@0 | 269 | void (* p_SHA384_DestroyContext)(SHA384Context *cx, PRBool freeit); |
michael@0 | 270 | void (* p_SHA384_Begin)(SHA384Context *cx); |
michael@0 | 271 | void (* p_SHA384_Update)(SHA384Context *cx, const unsigned char *input, |
michael@0 | 272 | unsigned int inputLen); |
michael@0 | 273 | void (* p_SHA384_End)(SHA384Context *cx, unsigned char *digest, |
michael@0 | 274 | unsigned int *digestLen, unsigned int maxDigestLen); |
michael@0 | 275 | SECStatus (* p_SHA384_HashBuf)(unsigned char *dest, const unsigned char *src, |
michael@0 | 276 | PRUint32 src_length); |
michael@0 | 277 | SECStatus (* p_SHA384_Hash)(unsigned char *dest, const char *src); |
michael@0 | 278 | void (* p_SHA384_TraceState)(SHA384Context *cx); |
michael@0 | 279 | unsigned int (* p_SHA384_FlattenSize)(SHA384Context *cx); |
michael@0 | 280 | SECStatus (* p_SHA384_Flatten)(SHA384Context *cx,unsigned char *space); |
michael@0 | 281 | SHA384Context * (* p_SHA384_Resurrect)(unsigned char *space, void *arg); |
michael@0 | 282 | |
michael@0 | 283 | /* Version 3.003 came to here */ |
michael@0 | 284 | |
michael@0 | 285 | AESKeyWrapContext * (* p_AESKeyWrap_CreateContext)(const unsigned char *key, |
michael@0 | 286 | const unsigned char *iv, int encrypt, unsigned int keylen); |
michael@0 | 287 | |
michael@0 | 288 | void (* p_AESKeyWrap_DestroyContext)(AESKeyWrapContext *cx, PRBool freeit); |
michael@0 | 289 | |
michael@0 | 290 | SECStatus (* p_AESKeyWrap_Encrypt)(AESKeyWrapContext *cx, |
michael@0 | 291 | unsigned char *output, |
michael@0 | 292 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 293 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 294 | |
michael@0 | 295 | SECStatus (* p_AESKeyWrap_Decrypt)(AESKeyWrapContext *cx, |
michael@0 | 296 | unsigned char *output, |
michael@0 | 297 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 298 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 299 | |
michael@0 | 300 | /* Version 3.004 came to here */ |
michael@0 | 301 | |
michael@0 | 302 | PRBool (*p_BLAPI_SHVerify)(const char *name, PRFuncPtr addr); |
michael@0 | 303 | PRBool (*p_BLAPI_VerifySelf)(const char *name); |
michael@0 | 304 | |
michael@0 | 305 | /* Version 3.005 came to here */ |
michael@0 | 306 | |
michael@0 | 307 | SECStatus (* p_EC_NewKey)(ECParams * params, |
michael@0 | 308 | ECPrivateKey ** privKey); |
michael@0 | 309 | |
michael@0 | 310 | SECStatus (* p_EC_NewKeyFromSeed)(ECParams * params, |
michael@0 | 311 | ECPrivateKey ** privKey, |
michael@0 | 312 | const unsigned char * seed, |
michael@0 | 313 | int seedlen); |
michael@0 | 314 | |
michael@0 | 315 | SECStatus (* p_EC_ValidatePublicKey)(ECParams * params, |
michael@0 | 316 | SECItem * publicValue); |
michael@0 | 317 | |
michael@0 | 318 | SECStatus (* p_ECDH_Derive)(SECItem * publicValue, |
michael@0 | 319 | ECParams * params, |
michael@0 | 320 | SECItem * privateValue, |
michael@0 | 321 | PRBool withCofactor, |
michael@0 | 322 | SECItem * derivedSecret); |
michael@0 | 323 | |
michael@0 | 324 | SECStatus (* p_ECDSA_SignDigest)(ECPrivateKey * key, |
michael@0 | 325 | SECItem * signature, |
michael@0 | 326 | const SECItem * digest); |
michael@0 | 327 | |
michael@0 | 328 | SECStatus (* p_ECDSA_VerifyDigest)(ECPublicKey * key, |
michael@0 | 329 | const SECItem * signature, |
michael@0 | 330 | const SECItem * digest); |
michael@0 | 331 | |
michael@0 | 332 | SECStatus (* p_ECDSA_SignDigestWithSeed)(ECPrivateKey * key, |
michael@0 | 333 | SECItem * signature, |
michael@0 | 334 | const SECItem * digest, |
michael@0 | 335 | const unsigned char * seed, |
michael@0 | 336 | const int seedlen); |
michael@0 | 337 | |
michael@0 | 338 | /* Version 3.006 came to here */ |
michael@0 | 339 | |
michael@0 | 340 | /* no modification to FREEBLVectorStr itself |
michael@0 | 341 | * but ECParamStr was modified |
michael@0 | 342 | */ |
michael@0 | 343 | |
michael@0 | 344 | /* Version 3.007 came to here */ |
michael@0 | 345 | |
michael@0 | 346 | SECStatus (* p_AES_InitContext)(AESContext *cx, |
michael@0 | 347 | const unsigned char *key, |
michael@0 | 348 | unsigned int keylen, |
michael@0 | 349 | const unsigned char *iv, |
michael@0 | 350 | int mode, |
michael@0 | 351 | unsigned int encrypt, |
michael@0 | 352 | unsigned int blocklen); |
michael@0 | 353 | SECStatus (* p_AESKeyWrap_InitContext)(AESKeyWrapContext *cx, |
michael@0 | 354 | const unsigned char *key, |
michael@0 | 355 | unsigned int keylen, |
michael@0 | 356 | const unsigned char *iv, |
michael@0 | 357 | int mode, |
michael@0 | 358 | unsigned int encrypt, |
michael@0 | 359 | unsigned int blocklen); |
michael@0 | 360 | SECStatus (* p_DES_InitContext)(DESContext *cx, |
michael@0 | 361 | const unsigned char *key, |
michael@0 | 362 | unsigned int keylen, |
michael@0 | 363 | const unsigned char *iv, |
michael@0 | 364 | int mode, |
michael@0 | 365 | unsigned int encrypt, |
michael@0 | 366 | unsigned int ); |
michael@0 | 367 | SECStatus (* p_RC2_InitContext)(RC2Context *cx, |
michael@0 | 368 | const unsigned char *key, |
michael@0 | 369 | unsigned int keylen, |
michael@0 | 370 | const unsigned char *iv, |
michael@0 | 371 | int mode, |
michael@0 | 372 | unsigned int effectiveKeyLen, |
michael@0 | 373 | unsigned int ); |
michael@0 | 374 | SECStatus (* p_RC4_InitContext)(RC4Context *cx, |
michael@0 | 375 | const unsigned char *key, |
michael@0 | 376 | unsigned int keylen, |
michael@0 | 377 | const unsigned char *, |
michael@0 | 378 | int, |
michael@0 | 379 | unsigned int , |
michael@0 | 380 | unsigned int ); |
michael@0 | 381 | |
michael@0 | 382 | AESContext *(*p_AES_AllocateContext)(void); |
michael@0 | 383 | AESKeyWrapContext *(*p_AESKeyWrap_AllocateContext)(void); |
michael@0 | 384 | DESContext *(*p_DES_AllocateContext)(void); |
michael@0 | 385 | RC2Context *(*p_RC2_AllocateContext)(void); |
michael@0 | 386 | RC4Context *(*p_RC4_AllocateContext)(void); |
michael@0 | 387 | |
michael@0 | 388 | void (* p_MD2_Clone)(MD2Context *dest, MD2Context *src); |
michael@0 | 389 | void (* p_MD5_Clone)(MD5Context *dest, MD5Context *src); |
michael@0 | 390 | void (* p_SHA1_Clone)(SHA1Context *dest, SHA1Context *src); |
michael@0 | 391 | void (* p_SHA256_Clone)(SHA256Context *dest, SHA256Context *src); |
michael@0 | 392 | void (* p_SHA384_Clone)(SHA384Context *dest, SHA384Context *src); |
michael@0 | 393 | void (* p_SHA512_Clone)(SHA512Context *dest, SHA512Context *src); |
michael@0 | 394 | |
michael@0 | 395 | SECStatus (* p_TLS_PRF)(const SECItem *secret, const char *label, |
michael@0 | 396 | SECItem *seed, SECItem *result, PRBool isFIPS); |
michael@0 | 397 | |
michael@0 | 398 | const SECHashObject *(* p_HASH_GetRawHashObject)(HASH_HashType hashType); |
michael@0 | 399 | |
michael@0 | 400 | HMACContext * (* p_HMAC_Create)(const SECHashObject *hashObj, |
michael@0 | 401 | const unsigned char *secret, |
michael@0 | 402 | unsigned int secret_len, PRBool isFIPS); |
michael@0 | 403 | SECStatus (* p_HMAC_Init)(HMACContext *cx, const SECHashObject *hash_obj, |
michael@0 | 404 | const unsigned char *secret, |
michael@0 | 405 | unsigned int secret_len, PRBool isFIPS); |
michael@0 | 406 | void (* p_HMAC_Begin)(HMACContext *cx); |
michael@0 | 407 | void (* p_HMAC_Update)(HMACContext *cx, const unsigned char *data, |
michael@0 | 408 | unsigned int data_len); |
michael@0 | 409 | HMACContext * (* p_HMAC_Clone)(HMACContext *cx); |
michael@0 | 410 | SECStatus (* p_HMAC_Finish)(HMACContext *cx, unsigned char *result, |
michael@0 | 411 | unsigned int *result_len, |
michael@0 | 412 | unsigned int max_result_len); |
michael@0 | 413 | void (* p_HMAC_Destroy)(HMACContext *cx, PRBool freeit); |
michael@0 | 414 | |
michael@0 | 415 | void (* p_RNG_SystemInfoForRNG)(void); |
michael@0 | 416 | |
michael@0 | 417 | /* Version 3.008 came to here */ |
michael@0 | 418 | |
michael@0 | 419 | SECStatus (* p_FIPS186Change_GenerateX)(unsigned char *XKEY, |
michael@0 | 420 | const unsigned char *XSEEDj, |
michael@0 | 421 | unsigned char *x_j); |
michael@0 | 422 | SECStatus (* p_FIPS186Change_ReduceModQForDSA)(const unsigned char *w, |
michael@0 | 423 | const unsigned char *q, |
michael@0 | 424 | unsigned char *xj); |
michael@0 | 425 | |
michael@0 | 426 | /* Version 3.009 came to here */ |
michael@0 | 427 | |
michael@0 | 428 | SECStatus (* p_Camellia_InitContext)(CamelliaContext *cx, |
michael@0 | 429 | const unsigned char *key, |
michael@0 | 430 | unsigned int keylen, |
michael@0 | 431 | const unsigned char *iv, |
michael@0 | 432 | int mode, |
michael@0 | 433 | unsigned int encrypt, |
michael@0 | 434 | unsigned int unused); |
michael@0 | 435 | |
michael@0 | 436 | CamelliaContext *(*p_Camellia_AllocateContext)(void); |
michael@0 | 437 | CamelliaContext * (* p_Camellia_CreateContext)(const unsigned char *key, |
michael@0 | 438 | const unsigned char *iv, |
michael@0 | 439 | int mode, int encrypt, |
michael@0 | 440 | unsigned int keylen); |
michael@0 | 441 | void (* p_Camellia_DestroyContext)(CamelliaContext *cx, PRBool freeit); |
michael@0 | 442 | |
michael@0 | 443 | SECStatus (* p_Camellia_Encrypt)(CamelliaContext *cx, unsigned char *output, |
michael@0 | 444 | unsigned int *outputLen, |
michael@0 | 445 | unsigned int maxOutputLen, |
michael@0 | 446 | const unsigned char *input, |
michael@0 | 447 | unsigned int inputLen); |
michael@0 | 448 | |
michael@0 | 449 | SECStatus (* p_Camellia_Decrypt)(CamelliaContext *cx, unsigned char *output, |
michael@0 | 450 | unsigned int *outputLen, |
michael@0 | 451 | unsigned int maxOutputLen, |
michael@0 | 452 | const unsigned char *input, |
michael@0 | 453 | unsigned int inputLen); |
michael@0 | 454 | |
michael@0 | 455 | void (* p_PQG_DestroyParams)(PQGParams *params); |
michael@0 | 456 | |
michael@0 | 457 | void (* p_PQG_DestroyVerify)(PQGVerify *vfy); |
michael@0 | 458 | |
michael@0 | 459 | /* Version 3.010 came to here */ |
michael@0 | 460 | |
michael@0 | 461 | SECStatus (* p_SEED_InitContext)(SEEDContext *cx, |
michael@0 | 462 | const unsigned char *key, |
michael@0 | 463 | unsigned int keylen, |
michael@0 | 464 | const unsigned char *iv, |
michael@0 | 465 | int mode, |
michael@0 | 466 | unsigned int encrypt, |
michael@0 | 467 | unsigned int ); |
michael@0 | 468 | |
michael@0 | 469 | SEEDContext *(*p_SEED_AllocateContext)(void); |
michael@0 | 470 | |
michael@0 | 471 | SEEDContext *(* p_SEED_CreateContext)(const unsigned char *key, |
michael@0 | 472 | const unsigned char *iv, |
michael@0 | 473 | int mode, PRBool encrypt); |
michael@0 | 474 | |
michael@0 | 475 | void (* p_SEED_DestroyContext)(SEEDContext *cx, PRBool freeit); |
michael@0 | 476 | |
michael@0 | 477 | SECStatus (* p_SEED_Encrypt)(SEEDContext *cx, unsigned char *output, |
michael@0 | 478 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 479 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 480 | |
michael@0 | 481 | SECStatus (* p_SEED_Decrypt)(SEEDContext *cx, unsigned char *output, |
michael@0 | 482 | unsigned int *outputLen, unsigned int maxOutputLen, |
michael@0 | 483 | const unsigned char *input, unsigned int inputLen); |
michael@0 | 484 | |
michael@0 | 485 | |
michael@0 | 486 | |
michael@0 | 487 | SECStatus (* p_BL_Init)(void); |
michael@0 | 488 | void ( * p_BL_SetForkState)(PRBool); |
michael@0 | 489 | |
michael@0 | 490 | SECStatus (* p_PRNGTEST_Instantiate)(const PRUint8 *entropy, |
michael@0 | 491 | unsigned int entropy_len, |
michael@0 | 492 | const PRUint8 *nonce, |
michael@0 | 493 | unsigned int nonce_len, |
michael@0 | 494 | const PRUint8 *personal_string, |
michael@0 | 495 | unsigned int ps_len); |
michael@0 | 496 | |
michael@0 | 497 | SECStatus (* p_PRNGTEST_Reseed)(const PRUint8 *entropy, |
michael@0 | 498 | unsigned int entropy_len, |
michael@0 | 499 | const PRUint8 *additional, |
michael@0 | 500 | unsigned int additional_len); |
michael@0 | 501 | |
michael@0 | 502 | SECStatus (* p_PRNGTEST_Generate)(PRUint8 *bytes, |
michael@0 | 503 | unsigned int bytes_len, |
michael@0 | 504 | const PRUint8 *additional, |
michael@0 | 505 | unsigned int additional_len); |
michael@0 | 506 | |
michael@0 | 507 | SECStatus (* p_PRNGTEST_Uninstantiate)(void); |
michael@0 | 508 | /* Version 3.011 came to here */ |
michael@0 | 509 | |
michael@0 | 510 | SECStatus (*p_RSA_PopulatePrivateKey)(RSAPrivateKey *key); |
michael@0 | 511 | |
michael@0 | 512 | SECStatus (*p_DSA_NewRandom)(PLArenaPool * arena, const SECItem * q, |
michael@0 | 513 | SECItem * seed); |
michael@0 | 514 | |
michael@0 | 515 | SECStatus (*p_JPAKE_Sign)(PLArenaPool * arena, const PQGParams * pqg, |
michael@0 | 516 | HASH_HashType hashType, const SECItem * signerID, |
michael@0 | 517 | const SECItem * x, const SECItem * testRandom, |
michael@0 | 518 | const SECItem * gxIn, SECItem * gxOut, |
michael@0 | 519 | SECItem * gv, SECItem * r); |
michael@0 | 520 | |
michael@0 | 521 | SECStatus (*p_JPAKE_Verify)(PLArenaPool * arena, const PQGParams * pqg, |
michael@0 | 522 | HASH_HashType hashType, const SECItem * signerID, |
michael@0 | 523 | const SECItem * peerID, const SECItem * gx, |
michael@0 | 524 | const SECItem * gv, const SECItem * r); |
michael@0 | 525 | |
michael@0 | 526 | SECStatus (*p_JPAKE_Round2)(PLArenaPool * arena, const SECItem * p, |
michael@0 | 527 | const SECItem *q, const SECItem * gx1, |
michael@0 | 528 | const SECItem * gx3, const SECItem * gx4, |
michael@0 | 529 | SECItem * base, const SECItem * x2, |
michael@0 | 530 | const SECItem * s, SECItem * x2s); |
michael@0 | 531 | |
michael@0 | 532 | SECStatus (*p_JPAKE_Final)(PLArenaPool * arena, const SECItem * p, |
michael@0 | 533 | const SECItem *q, const SECItem * x2, |
michael@0 | 534 | const SECItem * gx4, const SECItem * x2s, |
michael@0 | 535 | const SECItem * B, SECItem * K); |
michael@0 | 536 | |
michael@0 | 537 | /* Version 3.012 came to here */ |
michael@0 | 538 | |
michael@0 | 539 | SECStatus (* p_TLS_P_hash)(HASH_HashType hashAlg, |
michael@0 | 540 | const SECItem *secret, |
michael@0 | 541 | const char *label, |
michael@0 | 542 | SECItem *seed, |
michael@0 | 543 | SECItem *result, |
michael@0 | 544 | PRBool isFIPS); |
michael@0 | 545 | |
michael@0 | 546 | SHA224Context *(*p_SHA224_NewContext)(void); |
michael@0 | 547 | void (* p_SHA224_DestroyContext)(SHA224Context *cx, PRBool freeit); |
michael@0 | 548 | void (* p_SHA224_Begin)(SHA224Context *cx); |
michael@0 | 549 | void (* p_SHA224_Update)(SHA224Context *cx, const unsigned char *input, |
michael@0 | 550 | unsigned int inputLen); |
michael@0 | 551 | void (* p_SHA224_End)(SHA224Context *cx, unsigned char *digest, |
michael@0 | 552 | unsigned int *digestLen, unsigned int maxDigestLen); |
michael@0 | 553 | SECStatus (*p_SHA224_HashBuf)(unsigned char *dest, const unsigned char *src, |
michael@0 | 554 | PRUint32 src_length); |
michael@0 | 555 | SECStatus (*p_SHA224_Hash)(unsigned char *dest, const char *src); |
michael@0 | 556 | void (*p_SHA224_TraceState)(SHA224Context *cx); |
michael@0 | 557 | unsigned int (* p_SHA224_FlattenSize)(SHA224Context *cx); |
michael@0 | 558 | SECStatus (* p_SHA224_Flatten)(SHA224Context *cx,unsigned char *space); |
michael@0 | 559 | SHA224Context * (* p_SHA224_Resurrect)(unsigned char *space, void *arg); |
michael@0 | 560 | void (* p_SHA224_Clone)(SHA224Context *dest, SHA224Context *src); |
michael@0 | 561 | PRBool (*p_BLAPI_SHVerifyFile)(const char *name); |
michael@0 | 562 | |
michael@0 | 563 | /* Version 3.013 came to here */ |
michael@0 | 564 | |
michael@0 | 565 | SECStatus (* p_PQG_ParamGenV2)( unsigned int L, unsigned int N, |
michael@0 | 566 | unsigned int seedBytes, |
michael@0 | 567 | PQGParams **pParams, PQGVerify **pVfy); |
michael@0 | 568 | SECStatus (*p_PRNGTEST_RunHealthTests)(void); |
michael@0 | 569 | |
michael@0 | 570 | /* Version 3.014 came to here */ |
michael@0 | 571 | |
michael@0 | 572 | SECStatus (* p_HMAC_ConstantTime)( |
michael@0 | 573 | unsigned char *result, |
michael@0 | 574 | unsigned int *resultLen, |
michael@0 | 575 | unsigned int maxResultLen, |
michael@0 | 576 | const SECHashObject *hashObj, |
michael@0 | 577 | const unsigned char *secret, |
michael@0 | 578 | unsigned int secretLen, |
michael@0 | 579 | const unsigned char *header, |
michael@0 | 580 | unsigned int headerLen, |
michael@0 | 581 | const unsigned char *body, |
michael@0 | 582 | unsigned int bodyLen, |
michael@0 | 583 | unsigned int bodyTotalLen); |
michael@0 | 584 | |
michael@0 | 585 | SECStatus (* p_SSLv3_MAC_ConstantTime)( |
michael@0 | 586 | unsigned char *result, |
michael@0 | 587 | unsigned int *resultLen, |
michael@0 | 588 | unsigned int maxResultLen, |
michael@0 | 589 | const SECHashObject *hashObj, |
michael@0 | 590 | const unsigned char *secret, |
michael@0 | 591 | unsigned int secretLen, |
michael@0 | 592 | const unsigned char *header, |
michael@0 | 593 | unsigned int headerLen, |
michael@0 | 594 | const unsigned char *body, |
michael@0 | 595 | unsigned int bodyLen, |
michael@0 | 596 | unsigned int bodyTotalLen); |
michael@0 | 597 | |
michael@0 | 598 | /* Version 3.015 came to here */ |
michael@0 | 599 | |
michael@0 | 600 | SECStatus (* p_RSA_SignRaw)(RSAPrivateKey *key, |
michael@0 | 601 | unsigned char *output, |
michael@0 | 602 | unsigned int *outputLen, |
michael@0 | 603 | unsigned int maxOutputLen, |
michael@0 | 604 | const unsigned char *input, |
michael@0 | 605 | unsigned int inputLen); |
michael@0 | 606 | SECStatus (* p_RSA_CheckSignRaw)(RSAPublicKey *key, |
michael@0 | 607 | const unsigned char *sig, |
michael@0 | 608 | unsigned int sigLen, |
michael@0 | 609 | const unsigned char *hash, |
michael@0 | 610 | unsigned int hashLen); |
michael@0 | 611 | SECStatus (* p_RSA_CheckSignRecoverRaw)(RSAPublicKey *key, |
michael@0 | 612 | unsigned char *data, |
michael@0 | 613 | unsigned int *dataLen, |
michael@0 | 614 | unsigned int maxDataLen, |
michael@0 | 615 | const unsigned char *sig, |
michael@0 | 616 | unsigned int sigLen); |
michael@0 | 617 | SECStatus (* p_RSA_EncryptRaw)(RSAPublicKey *key, |
michael@0 | 618 | unsigned char *output, |
michael@0 | 619 | unsigned int *outputLen, |
michael@0 | 620 | unsigned int maxOutputLen, |
michael@0 | 621 | const unsigned char *input, |
michael@0 | 622 | unsigned int inputLen); |
michael@0 | 623 | SECStatus (* p_RSA_DecryptRaw)(RSAPrivateKey *key, |
michael@0 | 624 | unsigned char *output, |
michael@0 | 625 | unsigned int *outputLen, |
michael@0 | 626 | unsigned int maxOutputLen, |
michael@0 | 627 | const unsigned char *input, |
michael@0 | 628 | unsigned int inputLen); |
michael@0 | 629 | SECStatus (* p_RSA_EncryptOAEP)(RSAPublicKey *key, |
michael@0 | 630 | HASH_HashType hashAlg, |
michael@0 | 631 | HASH_HashType maskHashAlg, |
michael@0 | 632 | const unsigned char *label, |
michael@0 | 633 | unsigned int labelLen, |
michael@0 | 634 | const unsigned char *seed, |
michael@0 | 635 | unsigned int seedLen, |
michael@0 | 636 | unsigned char *output, |
michael@0 | 637 | unsigned int *outputLen, |
michael@0 | 638 | unsigned int maxOutputLen, |
michael@0 | 639 | const unsigned char *input, |
michael@0 | 640 | unsigned int inputLen); |
michael@0 | 641 | SECStatus (* p_RSA_DecryptOAEP)(RSAPrivateKey *key, |
michael@0 | 642 | HASH_HashType hashAlg, |
michael@0 | 643 | HASH_HashType maskHashAlg, |
michael@0 | 644 | const unsigned char *label, |
michael@0 | 645 | unsigned int labelLen, |
michael@0 | 646 | unsigned char *output, |
michael@0 | 647 | unsigned int *outputLen, |
michael@0 | 648 | unsigned int maxOutputLen, |
michael@0 | 649 | const unsigned char *input, |
michael@0 | 650 | unsigned int inputLen); |
michael@0 | 651 | SECStatus (* p_RSA_EncryptBlock)(RSAPublicKey *key, |
michael@0 | 652 | unsigned char *output, |
michael@0 | 653 | unsigned int *outputLen, |
michael@0 | 654 | unsigned int maxOutputLen, |
michael@0 | 655 | const unsigned char *input, |
michael@0 | 656 | unsigned int inputLen); |
michael@0 | 657 | SECStatus (* p_RSA_DecryptBlock)(RSAPrivateKey *key, |
michael@0 | 658 | unsigned char *output, |
michael@0 | 659 | unsigned int *outputLen, |
michael@0 | 660 | unsigned int maxOutputLen, |
michael@0 | 661 | const unsigned char *input, |
michael@0 | 662 | unsigned int inputLen); |
michael@0 | 663 | SECStatus (* p_RSA_SignPSS)(RSAPrivateKey *key, |
michael@0 | 664 | HASH_HashType hashAlg, |
michael@0 | 665 | HASH_HashType maskHashAlg, |
michael@0 | 666 | const unsigned char *salt, |
michael@0 | 667 | unsigned int saltLen, |
michael@0 | 668 | unsigned char *output, |
michael@0 | 669 | unsigned int *outputLen, |
michael@0 | 670 | unsigned int maxOutputLen, |
michael@0 | 671 | const unsigned char *input, |
michael@0 | 672 | unsigned int inputLen); |
michael@0 | 673 | SECStatus (* p_RSA_CheckSignPSS)(RSAPublicKey *key, |
michael@0 | 674 | HASH_HashType hashAlg, |
michael@0 | 675 | HASH_HashType maskHashAlg, |
michael@0 | 676 | unsigned int saltLen, |
michael@0 | 677 | const unsigned char *sig, |
michael@0 | 678 | unsigned int sigLen, |
michael@0 | 679 | const unsigned char *hash, |
michael@0 | 680 | unsigned int hashLen); |
michael@0 | 681 | SECStatus (* p_RSA_Sign)(RSAPrivateKey *key, |
michael@0 | 682 | unsigned char *output, |
michael@0 | 683 | unsigned int *outputLen, |
michael@0 | 684 | unsigned int maxOutputLen, |
michael@0 | 685 | const unsigned char *input, |
michael@0 | 686 | unsigned int inputLen); |
michael@0 | 687 | SECStatus (* p_RSA_CheckSign)(RSAPublicKey *key, |
michael@0 | 688 | const unsigned char *sig, |
michael@0 | 689 | unsigned int sigLen, |
michael@0 | 690 | const unsigned char *data, |
michael@0 | 691 | unsigned int dataLen); |
michael@0 | 692 | SECStatus (* p_RSA_CheckSignRecover)(RSAPublicKey *key, |
michael@0 | 693 | unsigned char *output, |
michael@0 | 694 | unsigned int *outputLen, |
michael@0 | 695 | unsigned int maxOutputLen, |
michael@0 | 696 | const unsigned char *sig, |
michael@0 | 697 | unsigned int sigLen); |
michael@0 | 698 | |
michael@0 | 699 | /* Version 3.016 came to here */ |
michael@0 | 700 | |
michael@0 | 701 | SECStatus (* p_EC_FillParams)(PLArenaPool *arena, |
michael@0 | 702 | const SECItem *encodedParams, ECParams *params); |
michael@0 | 703 | SECStatus (* p_EC_DecodeParams)(const SECItem *encodedParams, |
michael@0 | 704 | ECParams **ecparams); |
michael@0 | 705 | SECStatus (* p_EC_CopyParams)(PLArenaPool *arena, ECParams *dstParams, |
michael@0 | 706 | const ECParams *srcParams); |
michael@0 | 707 | |
michael@0 | 708 | /* Version 3.017 came to here */ |
michael@0 | 709 | |
michael@0 | 710 | /* Add new function pointers at the end of this struct and bump |
michael@0 | 711 | * FREEBL_VERSION at the beginning of this file. */ |
michael@0 | 712 | }; |
michael@0 | 713 | |
michael@0 | 714 | typedef struct FREEBLVectorStr FREEBLVector; |
michael@0 | 715 | |
michael@0 | 716 | SEC_BEGIN_PROTOS |
michael@0 | 717 | |
michael@0 | 718 | typedef const FREEBLVector * FREEBLGetVectorFn(void); |
michael@0 | 719 | |
michael@0 | 720 | extern FREEBLGetVectorFn FREEBL_GetVector; |
michael@0 | 721 | |
michael@0 | 722 | SEC_END_PROTOS |
michael@0 | 723 | |
michael@0 | 724 | #endif |