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 | * ldvector.c - 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 | #ifdef FREEBL_NO_DEPEND |
michael@0 | 9 | extern int FREEBL_InitStubs(void); |
michael@0 | 10 | #endif |
michael@0 | 11 | |
michael@0 | 12 | #include "loader.h" |
michael@0 | 13 | #include "alghmac.h" |
michael@0 | 14 | #include "hmacct.h" |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | static const struct FREEBLVectorStr vector = |
michael@0 | 18 | { |
michael@0 | 19 | |
michael@0 | 20 | sizeof vector, |
michael@0 | 21 | FREEBL_VERSION, |
michael@0 | 22 | |
michael@0 | 23 | RSA_NewKey, |
michael@0 | 24 | RSA_PublicKeyOp, |
michael@0 | 25 | RSA_PrivateKeyOp, |
michael@0 | 26 | DSA_NewKey, |
michael@0 | 27 | DSA_SignDigest, |
michael@0 | 28 | DSA_VerifyDigest, |
michael@0 | 29 | DSA_NewKeyFromSeed, |
michael@0 | 30 | DSA_SignDigestWithSeed, |
michael@0 | 31 | DH_GenParam, |
michael@0 | 32 | DH_NewKey, |
michael@0 | 33 | DH_Derive, |
michael@0 | 34 | KEA_Derive, |
michael@0 | 35 | KEA_Verify, |
michael@0 | 36 | RC4_CreateContext, |
michael@0 | 37 | RC4_DestroyContext, |
michael@0 | 38 | RC4_Encrypt, |
michael@0 | 39 | RC4_Decrypt, |
michael@0 | 40 | RC2_CreateContext, |
michael@0 | 41 | RC2_DestroyContext, |
michael@0 | 42 | RC2_Encrypt, |
michael@0 | 43 | RC2_Decrypt, |
michael@0 | 44 | RC5_CreateContext, |
michael@0 | 45 | RC5_DestroyContext, |
michael@0 | 46 | RC5_Encrypt, |
michael@0 | 47 | RC5_Decrypt, |
michael@0 | 48 | DES_CreateContext, |
michael@0 | 49 | DES_DestroyContext, |
michael@0 | 50 | DES_Encrypt, |
michael@0 | 51 | DES_Decrypt, |
michael@0 | 52 | AES_CreateContext, |
michael@0 | 53 | AES_DestroyContext, |
michael@0 | 54 | AES_Encrypt, |
michael@0 | 55 | AES_Decrypt, |
michael@0 | 56 | MD5_Hash, |
michael@0 | 57 | MD5_HashBuf, |
michael@0 | 58 | MD5_NewContext, |
michael@0 | 59 | MD5_DestroyContext, |
michael@0 | 60 | MD5_Begin, |
michael@0 | 61 | MD5_Update, |
michael@0 | 62 | MD5_End, |
michael@0 | 63 | MD5_FlattenSize, |
michael@0 | 64 | MD5_Flatten, |
michael@0 | 65 | MD5_Resurrect, |
michael@0 | 66 | MD5_TraceState, |
michael@0 | 67 | MD2_Hash, |
michael@0 | 68 | MD2_NewContext, |
michael@0 | 69 | MD2_DestroyContext, |
michael@0 | 70 | MD2_Begin, |
michael@0 | 71 | MD2_Update, |
michael@0 | 72 | MD2_End, |
michael@0 | 73 | MD2_FlattenSize, |
michael@0 | 74 | MD2_Flatten, |
michael@0 | 75 | MD2_Resurrect, |
michael@0 | 76 | SHA1_Hash, |
michael@0 | 77 | SHA1_HashBuf, |
michael@0 | 78 | SHA1_NewContext, |
michael@0 | 79 | SHA1_DestroyContext, |
michael@0 | 80 | SHA1_Begin, |
michael@0 | 81 | SHA1_Update, |
michael@0 | 82 | SHA1_End, |
michael@0 | 83 | SHA1_TraceState, |
michael@0 | 84 | SHA1_FlattenSize, |
michael@0 | 85 | SHA1_Flatten, |
michael@0 | 86 | SHA1_Resurrect, |
michael@0 | 87 | RNG_RNGInit, |
michael@0 | 88 | RNG_RandomUpdate, |
michael@0 | 89 | RNG_GenerateGlobalRandomBytes, |
michael@0 | 90 | RNG_RNGShutdown, |
michael@0 | 91 | PQG_ParamGen, |
michael@0 | 92 | PQG_ParamGenSeedLen, |
michael@0 | 93 | PQG_VerifyParams, |
michael@0 | 94 | |
michael@0 | 95 | /* End of Version 3.001. */ |
michael@0 | 96 | |
michael@0 | 97 | RSA_PrivateKeyOpDoubleChecked, |
michael@0 | 98 | RSA_PrivateKeyCheck, |
michael@0 | 99 | BL_Cleanup, |
michael@0 | 100 | |
michael@0 | 101 | /* End of Version 3.002. */ |
michael@0 | 102 | |
michael@0 | 103 | SHA256_NewContext, |
michael@0 | 104 | SHA256_DestroyContext, |
michael@0 | 105 | SHA256_Begin, |
michael@0 | 106 | SHA256_Update, |
michael@0 | 107 | SHA256_End, |
michael@0 | 108 | SHA256_HashBuf, |
michael@0 | 109 | SHA256_Hash, |
michael@0 | 110 | SHA256_TraceState, |
michael@0 | 111 | SHA256_FlattenSize, |
michael@0 | 112 | SHA256_Flatten, |
michael@0 | 113 | SHA256_Resurrect, |
michael@0 | 114 | |
michael@0 | 115 | SHA512_NewContext, |
michael@0 | 116 | SHA512_DestroyContext, |
michael@0 | 117 | SHA512_Begin, |
michael@0 | 118 | SHA512_Update, |
michael@0 | 119 | SHA512_End, |
michael@0 | 120 | SHA512_HashBuf, |
michael@0 | 121 | SHA512_Hash, |
michael@0 | 122 | SHA512_TraceState, |
michael@0 | 123 | SHA512_FlattenSize, |
michael@0 | 124 | SHA512_Flatten, |
michael@0 | 125 | SHA512_Resurrect, |
michael@0 | 126 | |
michael@0 | 127 | SHA384_NewContext, |
michael@0 | 128 | SHA384_DestroyContext, |
michael@0 | 129 | SHA384_Begin, |
michael@0 | 130 | SHA384_Update, |
michael@0 | 131 | SHA384_End, |
michael@0 | 132 | SHA384_HashBuf, |
michael@0 | 133 | SHA384_Hash, |
michael@0 | 134 | SHA384_TraceState, |
michael@0 | 135 | SHA384_FlattenSize, |
michael@0 | 136 | SHA384_Flatten, |
michael@0 | 137 | SHA384_Resurrect, |
michael@0 | 138 | |
michael@0 | 139 | /* End of Version 3.003. */ |
michael@0 | 140 | |
michael@0 | 141 | AESKeyWrap_CreateContext, |
michael@0 | 142 | AESKeyWrap_DestroyContext, |
michael@0 | 143 | AESKeyWrap_Encrypt, |
michael@0 | 144 | AESKeyWrap_Decrypt, |
michael@0 | 145 | |
michael@0 | 146 | /* End of Version 3.004. */ |
michael@0 | 147 | |
michael@0 | 148 | BLAPI_SHVerify, |
michael@0 | 149 | BLAPI_VerifySelf, |
michael@0 | 150 | |
michael@0 | 151 | /* End of Version 3.005. */ |
michael@0 | 152 | |
michael@0 | 153 | EC_NewKey, |
michael@0 | 154 | EC_NewKeyFromSeed, |
michael@0 | 155 | EC_ValidatePublicKey, |
michael@0 | 156 | ECDH_Derive, |
michael@0 | 157 | ECDSA_SignDigest, |
michael@0 | 158 | ECDSA_VerifyDigest, |
michael@0 | 159 | ECDSA_SignDigestWithSeed, |
michael@0 | 160 | |
michael@0 | 161 | /* End of Version 3.006. */ |
michael@0 | 162 | /* End of Version 3.007. */ |
michael@0 | 163 | |
michael@0 | 164 | AES_InitContext, |
michael@0 | 165 | AESKeyWrap_InitContext, |
michael@0 | 166 | DES_InitContext, |
michael@0 | 167 | RC2_InitContext, |
michael@0 | 168 | RC4_InitContext, |
michael@0 | 169 | |
michael@0 | 170 | AES_AllocateContext, |
michael@0 | 171 | AESKeyWrap_AllocateContext, |
michael@0 | 172 | DES_AllocateContext, |
michael@0 | 173 | RC2_AllocateContext, |
michael@0 | 174 | RC4_AllocateContext, |
michael@0 | 175 | |
michael@0 | 176 | MD2_Clone, |
michael@0 | 177 | MD5_Clone, |
michael@0 | 178 | SHA1_Clone, |
michael@0 | 179 | SHA256_Clone, |
michael@0 | 180 | SHA384_Clone, |
michael@0 | 181 | SHA512_Clone, |
michael@0 | 182 | |
michael@0 | 183 | TLS_PRF, |
michael@0 | 184 | HASH_GetRawHashObject, |
michael@0 | 185 | |
michael@0 | 186 | HMAC_Create, |
michael@0 | 187 | HMAC_Init, |
michael@0 | 188 | HMAC_Begin, |
michael@0 | 189 | HMAC_Update, |
michael@0 | 190 | HMAC_Clone, |
michael@0 | 191 | HMAC_Finish, |
michael@0 | 192 | HMAC_Destroy, |
michael@0 | 193 | |
michael@0 | 194 | RNG_SystemInfoForRNG, |
michael@0 | 195 | |
michael@0 | 196 | /* End of Version 3.008. */ |
michael@0 | 197 | |
michael@0 | 198 | FIPS186Change_GenerateX, |
michael@0 | 199 | FIPS186Change_ReduceModQForDSA, |
michael@0 | 200 | |
michael@0 | 201 | /* End of Version 3.009. */ |
michael@0 | 202 | Camellia_InitContext, |
michael@0 | 203 | Camellia_AllocateContext, |
michael@0 | 204 | Camellia_CreateContext, |
michael@0 | 205 | Camellia_DestroyContext, |
michael@0 | 206 | Camellia_Encrypt, |
michael@0 | 207 | Camellia_Decrypt, |
michael@0 | 208 | |
michael@0 | 209 | PQG_DestroyParams, |
michael@0 | 210 | PQG_DestroyVerify, |
michael@0 | 211 | |
michael@0 | 212 | /* End of Version 3.010. */ |
michael@0 | 213 | |
michael@0 | 214 | SEED_InitContext, |
michael@0 | 215 | SEED_AllocateContext, |
michael@0 | 216 | SEED_CreateContext, |
michael@0 | 217 | SEED_DestroyContext, |
michael@0 | 218 | SEED_Encrypt, |
michael@0 | 219 | SEED_Decrypt, |
michael@0 | 220 | |
michael@0 | 221 | BL_Init, |
michael@0 | 222 | BL_SetForkState, |
michael@0 | 223 | |
michael@0 | 224 | PRNGTEST_Instantiate, |
michael@0 | 225 | PRNGTEST_Reseed, |
michael@0 | 226 | PRNGTEST_Generate, |
michael@0 | 227 | |
michael@0 | 228 | PRNGTEST_Uninstantiate, |
michael@0 | 229 | |
michael@0 | 230 | /* End of Version 3.011. */ |
michael@0 | 231 | |
michael@0 | 232 | RSA_PopulatePrivateKey, |
michael@0 | 233 | |
michael@0 | 234 | DSA_NewRandom, |
michael@0 | 235 | |
michael@0 | 236 | JPAKE_Sign, |
michael@0 | 237 | JPAKE_Verify, |
michael@0 | 238 | JPAKE_Round2, |
michael@0 | 239 | JPAKE_Final, |
michael@0 | 240 | |
michael@0 | 241 | /* End of Version 3.012 */ |
michael@0 | 242 | |
michael@0 | 243 | TLS_P_hash, |
michael@0 | 244 | SHA224_NewContext, |
michael@0 | 245 | SHA224_DestroyContext, |
michael@0 | 246 | SHA224_Begin, |
michael@0 | 247 | SHA224_Update, |
michael@0 | 248 | SHA224_End, |
michael@0 | 249 | SHA224_HashBuf, |
michael@0 | 250 | SHA224_Hash, |
michael@0 | 251 | SHA224_TraceState, |
michael@0 | 252 | SHA224_FlattenSize, |
michael@0 | 253 | SHA224_Flatten, |
michael@0 | 254 | SHA224_Resurrect, |
michael@0 | 255 | SHA224_Clone, |
michael@0 | 256 | BLAPI_SHVerifyFile, |
michael@0 | 257 | |
michael@0 | 258 | /* End of Version 3.013 */ |
michael@0 | 259 | |
michael@0 | 260 | PQG_ParamGenV2, |
michael@0 | 261 | PRNGTEST_RunHealthTests, |
michael@0 | 262 | |
michael@0 | 263 | /* End of Version 3.014 */ |
michael@0 | 264 | |
michael@0 | 265 | HMAC_ConstantTime, |
michael@0 | 266 | SSLv3_MAC_ConstantTime, |
michael@0 | 267 | |
michael@0 | 268 | /* End of Version 3.015 */ |
michael@0 | 269 | |
michael@0 | 270 | RSA_SignRaw, |
michael@0 | 271 | RSA_CheckSignRaw, |
michael@0 | 272 | RSA_CheckSignRecoverRaw, |
michael@0 | 273 | RSA_EncryptRaw, |
michael@0 | 274 | RSA_DecryptRaw, |
michael@0 | 275 | RSA_EncryptOAEP, |
michael@0 | 276 | RSA_DecryptOAEP, |
michael@0 | 277 | RSA_EncryptBlock, |
michael@0 | 278 | RSA_DecryptBlock, |
michael@0 | 279 | RSA_SignPSS, |
michael@0 | 280 | RSA_CheckSignPSS, |
michael@0 | 281 | RSA_Sign, |
michael@0 | 282 | RSA_CheckSign, |
michael@0 | 283 | RSA_CheckSignRecover, |
michael@0 | 284 | |
michael@0 | 285 | /* End of Version 3.016 */ |
michael@0 | 286 | |
michael@0 | 287 | EC_FillParams, |
michael@0 | 288 | EC_DecodeParams, |
michael@0 | 289 | EC_CopyParams |
michael@0 | 290 | |
michael@0 | 291 | /* End of Version 3.017 */ |
michael@0 | 292 | }; |
michael@0 | 293 | |
michael@0 | 294 | const FREEBLVector * |
michael@0 | 295 | FREEBL_GetVector(void) |
michael@0 | 296 | { |
michael@0 | 297 | extern const char __nss_freebl_rcsid[]; |
michael@0 | 298 | extern const char __nss_freebl_sccsid[]; |
michael@0 | 299 | |
michael@0 | 300 | /* force a reference that won't get optimized away */ |
michael@0 | 301 | volatile char c; |
michael@0 | 302 | |
michael@0 | 303 | c = __nss_freebl_rcsid[0] + __nss_freebl_sccsid[0]; |
michael@0 | 304 | #ifdef FREEBL_NO_DEPEND |
michael@0 | 305 | FREEBL_InitStubs(); |
michael@0 | 306 | #endif |
michael@0 | 307 | return &vector; |
michael@0 | 308 | } |
michael@0 | 309 |