summaryrefslogtreecommitdiff
path: root/security/nss/lib/freebl/loader.h
blob: ff10cf9bad20ab934842a945f008c745e5bc7d27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
/*
 * loader.h - load platform dependent DSO containing freebl implementation.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef _LOADER_H_
#define _LOADER_H_ 1

#include "blapi.h"

#define FREEBL_VERSION 0x0314

struct FREEBLVectorStr {

    unsigned short length;  /* of this struct in bytes */
    unsigned short version; /* of this struct. */

    RSAPrivateKey *(*p_RSA_NewKey)(int keySizeInBits,
                                   SECItem *publicExponent);

    SECStatus (*p_RSA_PublicKeyOp)(RSAPublicKey *key,
                                   unsigned char *output,
                                   const unsigned char *input);

    SECStatus (*p_RSA_PrivateKeyOp)(RSAPrivateKey *key,
                                    unsigned char *output,
                                    const unsigned char *input);

    SECStatus (*p_DSA_NewKey)(const PQGParams *params,
                              DSAPrivateKey **privKey);

    SECStatus (*p_DSA_SignDigest)(DSAPrivateKey *key,
                                  SECItem *signature,
                                  const SECItem *digest);

    SECStatus (*p_DSA_VerifyDigest)(DSAPublicKey *key,
                                    const SECItem *signature,
                                    const SECItem *digest);

    SECStatus (*p_DSA_NewKeyFromSeed)(const PQGParams *params,
                                      const unsigned char *seed,
                                      DSAPrivateKey **privKey);

    SECStatus (*p_DSA_SignDigestWithSeed)(DSAPrivateKey *key,
                                          SECItem *signature,
                                          const SECItem *digest,
                                          const unsigned char *seed);

    SECStatus (*p_DH_GenParam)(int primeLen, DHParams **params);

    SECStatus (*p_DH_NewKey)(DHParams *params,
                             DHPrivateKey **privKey);

    SECStatus (*p_DH_Derive)(SECItem *publicValue,
                             SECItem *prime,
                             SECItem *privateValue,
                             SECItem *derivedSecret,
                             unsigned int maxOutBytes);

    SECStatus (*p_KEA_Derive)(SECItem *prime,
                              SECItem *public1,
                              SECItem *public2,
                              SECItem *private1,
                              SECItem *private2,
                              SECItem *derivedSecret);

    PRBool (*p_KEA_Verify)(SECItem *Y, SECItem *prime, SECItem *subPrime);

    RC4Context *(*p_RC4_CreateContext)(const unsigned char *key, int len);

    void (*p_RC4_DestroyContext)(RC4Context *cx, PRBool freeit);

    SECStatus (*p_RC4_Encrypt)(RC4Context *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_RC4_Decrypt)(RC4Context *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    RC2Context *(*p_RC2_CreateContext)(const unsigned char *key,
                                       unsigned int len, const unsigned char *iv,
                                       int mode, unsigned effectiveKeyLen);

    void (*p_RC2_DestroyContext)(RC2Context *cx, PRBool freeit);

    SECStatus (*p_RC2_Encrypt)(RC2Context *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_RC2_Decrypt)(RC2Context *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    RC5Context *(*p_RC5_CreateContext)(const SECItem *key, unsigned int rounds,
                                       unsigned int wordSize, const unsigned char *iv, int mode);

    void (*p_RC5_DestroyContext)(RC5Context *cx, PRBool freeit);

    SECStatus (*p_RC5_Encrypt)(RC5Context *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_RC5_Decrypt)(RC5Context *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    DESContext *(*p_DES_CreateContext)(const unsigned char *key,
                                       const unsigned char *iv,
                                       int mode, PRBool encrypt);

    void (*p_DES_DestroyContext)(DESContext *cx, PRBool freeit);

    SECStatus (*p_DES_Encrypt)(DESContext *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_DES_Decrypt)(DESContext *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    AESContext *(*p_AES_CreateContext)(const unsigned char *key,
                                       const unsigned char *iv,
                                       int mode, int encrypt, unsigned int keylen,
                                       unsigned int blocklen);

    void (*p_AES_DestroyContext)(AESContext *cx, PRBool freeit);

    SECStatus (*p_AES_Encrypt)(AESContext *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_AES_Decrypt)(AESContext *cx, unsigned char *output,
                               unsigned int *outputLen, unsigned int maxOutputLen,
                               const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_MD5_Hash)(unsigned char *dest, const char *src);

    SECStatus (*p_MD5_HashBuf)(unsigned char *dest, const unsigned char *src,
                               PRUint32 src_length);

    MD5Context *(*p_MD5_NewContext)(void);

    void (*p_MD5_DestroyContext)(MD5Context *cx, PRBool freeit);

    void (*p_MD5_Begin)(MD5Context *cx);

    void (*p_MD5_Update)(MD5Context *cx,
                         const unsigned char *input, unsigned int inputLen);

    void (*p_MD5_End)(MD5Context *cx, unsigned char *digest,
                      unsigned int *digestLen, unsigned int maxDigestLen);

    unsigned int (*p_MD5_FlattenSize)(MD5Context *cx);

    SECStatus (*p_MD5_Flatten)(MD5Context *cx, unsigned char *space);

    MD5Context *(*p_MD5_Resurrect)(unsigned char *space, void *arg);

    void (*p_MD5_TraceState)(MD5Context *cx);

    SECStatus (*p_MD2_Hash)(unsigned char *dest, const char *src);

    MD2Context *(*p_MD2_NewContext)(void);

    void (*p_MD2_DestroyContext)(MD2Context *cx, PRBool freeit);

    void (*p_MD2_Begin)(MD2Context *cx);

    void (*p_MD2_Update)(MD2Context *cx,
                         const unsigned char *input, unsigned int inputLen);

    void (*p_MD2_End)(MD2Context *cx, unsigned char *digest,
                      unsigned int *digestLen, unsigned int maxDigestLen);

    unsigned int (*p_MD2_FlattenSize)(MD2Context *cx);

    SECStatus (*p_MD2_Flatten)(MD2Context *cx, unsigned char *space);

    MD2Context *(*p_MD2_Resurrect)(unsigned char *space, void *arg);

    SECStatus (*p_SHA1_Hash)(unsigned char *dest, const char *src);

    SECStatus (*p_SHA1_HashBuf)(unsigned char *dest, const unsigned char *src,
                                PRUint32 src_length);

    SHA1Context *(*p_SHA1_NewContext)(void);

    void (*p_SHA1_DestroyContext)(SHA1Context *cx, PRBool freeit);

    void (*p_SHA1_Begin)(SHA1Context *cx);

    void (*p_SHA1_Update)(SHA1Context *cx, const unsigned char *input,
                          unsigned int inputLen);

    void (*p_SHA1_End)(SHA1Context *cx, unsigned char *digest,
                       unsigned int *digestLen, unsigned int maxDigestLen);

    void (*p_SHA1_TraceState)(SHA1Context *cx);

    unsigned int (*p_SHA1_FlattenSize)(SHA1Context *cx);

    SECStatus (*p_SHA1_Flatten)(SHA1Context *cx, unsigned char *space);

    SHA1Context *(*p_SHA1_Resurrect)(unsigned char *space, void *arg);

    SECStatus (*p_RNG_RNGInit)(void);

    SECStatus (*p_RNG_RandomUpdate)(const void *data, size_t bytes);

    SECStatus (*p_RNG_GenerateGlobalRandomBytes)(void *dest, size_t len);

    void (*p_RNG_RNGShutdown)(void);

    SECStatus (*p_PQG_ParamGen)(unsigned int j, PQGParams **pParams,
                                PQGVerify **pVfy);

    SECStatus (*p_PQG_ParamGenSeedLen)(unsigned int j, unsigned int seedBytes,
                                       PQGParams **pParams, PQGVerify **pVfy);

    SECStatus (*p_PQG_VerifyParams)(const PQGParams *params,
                                    const PQGVerify *vfy, SECStatus *result);

    /* Version 3.001 came to here */

    SECStatus (*p_RSA_PrivateKeyOpDoubleChecked)(RSAPrivateKey *key,
                                                 unsigned char *output,
                                                 const unsigned char *input);

    SECStatus (*p_RSA_PrivateKeyCheck)(const RSAPrivateKey *key);

    void (*p_BL_Cleanup)(void);

    /* Version 3.002 came to here */

    SHA256Context *(*p_SHA256_NewContext)(void);
    void (*p_SHA256_DestroyContext)(SHA256Context *cx, PRBool freeit);
    void (*p_SHA256_Begin)(SHA256Context *cx);
    void (*p_SHA256_Update)(SHA256Context *cx, const unsigned char *input,
                            unsigned int inputLen);
    void (*p_SHA256_End)(SHA256Context *cx, unsigned char *digest,
                         unsigned int *digestLen, unsigned int maxDigestLen);
    SECStatus (*p_SHA256_HashBuf)(unsigned char *dest, const unsigned char *src,
                                  PRUint32 src_length);
    SECStatus (*p_SHA256_Hash)(unsigned char *dest, const char *src);
    void (*p_SHA256_TraceState)(SHA256Context *cx);
    unsigned int (*p_SHA256_FlattenSize)(SHA256Context *cx);
    SECStatus (*p_SHA256_Flatten)(SHA256Context *cx, unsigned char *space);
    SHA256Context *(*p_SHA256_Resurrect)(unsigned char *space, void *arg);

    SHA512Context *(*p_SHA512_NewContext)(void);
    void (*p_SHA512_DestroyContext)(SHA512Context *cx, PRBool freeit);
    void (*p_SHA512_Begin)(SHA512Context *cx);
    void (*p_SHA512_Update)(SHA512Context *cx, const unsigned char *input,
                            unsigned int inputLen);
    void (*p_SHA512_End)(SHA512Context *cx, unsigned char *digest,
                         unsigned int *digestLen, unsigned int maxDigestLen);
    SECStatus (*p_SHA512_HashBuf)(unsigned char *dest, const unsigned char *src,
                                  PRUint32 src_length);
    SECStatus (*p_SHA512_Hash)(unsigned char *dest, const char *src);
    void (*p_SHA512_TraceState)(SHA512Context *cx);
    unsigned int (*p_SHA512_FlattenSize)(SHA512Context *cx);
    SECStatus (*p_SHA512_Flatten)(SHA512Context *cx, unsigned char *space);
    SHA512Context *(*p_SHA512_Resurrect)(unsigned char *space, void *arg);

    SHA384Context *(*p_SHA384_NewContext)(void);
    void (*p_SHA384_DestroyContext)(SHA384Context *cx, PRBool freeit);
    void (*p_SHA384_Begin)(SHA384Context *cx);
    void (*p_SHA384_Update)(SHA384Context *cx, const unsigned char *input,
                            unsigned int inputLen);
    void (*p_SHA384_End)(SHA384Context *cx, unsigned char *digest,
                         unsigned int *digestLen, unsigned int maxDigestLen);
    SECStatus (*p_SHA384_HashBuf)(unsigned char *dest, const unsigned char *src,
                                  PRUint32 src_length);
    SECStatus (*p_SHA384_Hash)(unsigned char *dest, const char *src);
    void (*p_SHA384_TraceState)(SHA384Context *cx);
    unsigned int (*p_SHA384_FlattenSize)(SHA384Context *cx);
    SECStatus (*p_SHA384_Flatten)(SHA384Context *cx, unsigned char *space);
    SHA384Context *(*p_SHA384_Resurrect)(unsigned char *space, void *arg);

    /* Version 3.003 came to here */

    AESKeyWrapContext *(*p_AESKeyWrap_CreateContext)(const unsigned char *key,
                                                     const unsigned char *iv, int encrypt, unsigned int keylen);

    void (*p_AESKeyWrap_DestroyContext)(AESKeyWrapContext *cx, PRBool freeit);

    SECStatus (*p_AESKeyWrap_Encrypt)(AESKeyWrapContext *cx,
                                      unsigned char *output,
                                      unsigned int *outputLen, unsigned int maxOutputLen,
                                      const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_AESKeyWrap_Decrypt)(AESKeyWrapContext *cx,
                                      unsigned char *output,
                                      unsigned int *outputLen, unsigned int maxOutputLen,
                                      const unsigned char *input, unsigned int inputLen);

    /* Version 3.004 came to here */

    PRBool (*p_BLAPI_SHVerify)(const char *name, PRFuncPtr addr);
    PRBool (*p_BLAPI_VerifySelf)(const char *name);

    /* Version 3.005 came to here */

    SECStatus (*p_EC_NewKey)(ECParams *params,
                             ECPrivateKey **privKey);

    SECStatus (*p_EC_NewKeyFromSeed)(ECParams *params,
                                     ECPrivateKey **privKey,
                                     const unsigned char *seed,
                                     int seedlen);

    SECStatus (*p_EC_ValidatePublicKey)(ECParams *params,
                                        SECItem *publicValue);

    SECStatus (*p_ECDH_Derive)(SECItem *publicValue,
                               ECParams *params,
                               SECItem *privateValue,
                               PRBool withCofactor,
                               SECItem *derivedSecret);

    SECStatus (*p_ECDSA_SignDigest)(ECPrivateKey *key,
                                    SECItem *signature,
                                    const SECItem *digest);

    SECStatus (*p_ECDSA_VerifyDigest)(ECPublicKey *key,
                                      const SECItem *signature,
                                      const SECItem *digest);

    SECStatus (*p_ECDSA_SignDigestWithSeed)(ECPrivateKey *key,
                                            SECItem *signature,
                                            const SECItem *digest,
                                            const unsigned char *seed,
                                            const int seedlen);

    /* Version 3.006 came to here */

    /* no modification to FREEBLVectorStr itself
   * but ECParamStr was modified
   */

    /* Version 3.007 came to here */

    SECStatus (*p_AES_InitContext)(AESContext *cx,
                                   const unsigned char *key,
                                   unsigned int keylen,
                                   const unsigned char *iv,
                                   int mode,
                                   unsigned int encrypt,
                                   unsigned int blocklen);
    SECStatus (*p_AESKeyWrap_InitContext)(AESKeyWrapContext *cx,
                                          const unsigned char *key,
                                          unsigned int keylen,
                                          const unsigned char *iv,
                                          int mode,
                                          unsigned int encrypt,
                                          unsigned int blocklen);
    SECStatus (*p_DES_InitContext)(DESContext *cx,
                                   const unsigned char *key,
                                   unsigned int keylen,
                                   const unsigned char *iv,
                                   int mode,
                                   unsigned int encrypt,
                                   unsigned int);
    SECStatus (*p_RC2_InitContext)(RC2Context *cx,
                                   const unsigned char *key,
                                   unsigned int keylen,
                                   const unsigned char *iv,
                                   int mode,
                                   unsigned int effectiveKeyLen,
                                   unsigned int);
    SECStatus (*p_RC4_InitContext)(RC4Context *cx,
                                   const unsigned char *key,
                                   unsigned int keylen,
                                   const unsigned char *,
                                   int,
                                   unsigned int,
                                   unsigned int);

    AESContext *(*p_AES_AllocateContext)(void);
    AESKeyWrapContext *(*p_AESKeyWrap_AllocateContext)(void);
    DESContext *(*p_DES_AllocateContext)(void);
    RC2Context *(*p_RC2_AllocateContext)(void);
    RC4Context *(*p_RC4_AllocateContext)(void);

    void (*p_MD2_Clone)(MD2Context *dest, MD2Context *src);
    void (*p_MD5_Clone)(MD5Context *dest, MD5Context *src);
    void (*p_SHA1_Clone)(SHA1Context *dest, SHA1Context *src);
    void (*p_SHA256_Clone)(SHA256Context *dest, SHA256Context *src);
    void (*p_SHA384_Clone)(SHA384Context *dest, SHA384Context *src);
    void (*p_SHA512_Clone)(SHA512Context *dest, SHA512Context *src);

    SECStatus (*p_TLS_PRF)(const SECItem *secret, const char *label,
                           SECItem *seed, SECItem *result, PRBool isFIPS);

    const SECHashObject *(*p_HASH_GetRawHashObject)(HASH_HashType hashType);

    HMACContext *(*p_HMAC_Create)(const SECHashObject *hashObj,
                                  const unsigned char *secret,
                                  unsigned int secret_len, PRBool isFIPS);
    SECStatus (*p_HMAC_Init)(HMACContext *cx, const SECHashObject *hash_obj,
                             const unsigned char *secret,
                             unsigned int secret_len, PRBool isFIPS);
    void (*p_HMAC_Begin)(HMACContext *cx);
    void (*p_HMAC_Update)(HMACContext *cx, const unsigned char *data,
                          unsigned int data_len);
    HMACContext *(*p_HMAC_Clone)(HMACContext *cx);
    SECStatus (*p_HMAC_Finish)(HMACContext *cx, unsigned char *result,
                               unsigned int *result_len,
                               unsigned int max_result_len);
    void (*p_HMAC_Destroy)(HMACContext *cx, PRBool freeit);

    void (*p_RNG_SystemInfoForRNG)(void);

    /* Version 3.008 came to here */

    SECStatus (*p_FIPS186Change_GenerateX)(unsigned char *XKEY,
                                           const unsigned char *XSEEDj,
                                           unsigned char *x_j);
    SECStatus (*p_FIPS186Change_ReduceModQForDSA)(const unsigned char *w,
                                                  const unsigned char *q,
                                                  unsigned char *xj);

    /* Version 3.009 came to here */

    SECStatus (*p_Camellia_InitContext)(CamelliaContext *cx,
                                        const unsigned char *key,
                                        unsigned int keylen,
                                        const unsigned char *iv,
                                        int mode,
                                        unsigned int encrypt,
                                        unsigned int unused);

    CamelliaContext *(*p_Camellia_AllocateContext)(void);
    CamelliaContext *(*p_Camellia_CreateContext)(const unsigned char *key,
                                                 const unsigned char *iv,
                                                 int mode, int encrypt,
                                                 unsigned int keylen);
    void (*p_Camellia_DestroyContext)(CamelliaContext *cx, PRBool freeit);

    SECStatus (*p_Camellia_Encrypt)(CamelliaContext *cx, unsigned char *output,
                                    unsigned int *outputLen,
                                    unsigned int maxOutputLen,
                                    const unsigned char *input,
                                    unsigned int inputLen);

    SECStatus (*p_Camellia_Decrypt)(CamelliaContext *cx, unsigned char *output,
                                    unsigned int *outputLen,
                                    unsigned int maxOutputLen,
                                    const unsigned char *input,
                                    unsigned int inputLen);

    void (*p_PQG_DestroyParams)(PQGParams *params);

    void (*p_PQG_DestroyVerify)(PQGVerify *vfy);

    /* Version 3.010 came to here */

    SECStatus (*p_SEED_InitContext)(SEEDContext *cx,
                                    const unsigned char *key,
                                    unsigned int keylen,
                                    const unsigned char *iv,
                                    int mode,
                                    unsigned int encrypt,
                                    unsigned int);

    SEEDContext *(*p_SEED_AllocateContext)(void);

    SEEDContext *(*p_SEED_CreateContext)(const unsigned char *key,
                                         const unsigned char *iv,
                                         int mode, PRBool encrypt);

    void (*p_SEED_DestroyContext)(SEEDContext *cx, PRBool freeit);

    SECStatus (*p_SEED_Encrypt)(SEEDContext *cx, unsigned char *output,
                                unsigned int *outputLen, unsigned int maxOutputLen,
                                const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_SEED_Decrypt)(SEEDContext *cx, unsigned char *output,
                                unsigned int *outputLen, unsigned int maxOutputLen,
                                const unsigned char *input, unsigned int inputLen);

    SECStatus (*p_BL_Init)(void);
    void (*p_BL_SetForkState)(PRBool);

    SECStatus (*p_PRNGTEST_Instantiate)(const PRUint8 *entropy,
                                        unsigned int entropy_len,
                                        const PRUint8 *nonce,
                                        unsigned int nonce_len,
                                        const PRUint8 *personal_string,
                                        unsigned int ps_len);

    SECStatus (*p_PRNGTEST_Reseed)(const PRUint8 *entropy,
                                   unsigned int entropy_len,
                                   const PRUint8 *additional,
                                   unsigned int additional_len);

    SECStatus (*p_PRNGTEST_Generate)(PRUint8 *bytes,
                                     unsigned int bytes_len,
                                     const PRUint8 *additional,
                                     unsigned int additional_len);

    SECStatus (*p_PRNGTEST_Uninstantiate)(void);
    /* Version 3.011 came to here */

    SECStatus (*p_RSA_PopulatePrivateKey)(RSAPrivateKey *key);

    SECStatus (*p_DSA_NewRandom)(PLArenaPool *arena, const SECItem *q,
                                 SECItem *seed);

    SECStatus (*p_JPAKE_Sign)(PLArenaPool *arena, const PQGParams *pqg,
                              HASH_HashType hashType, const SECItem *signerID,
                              const SECItem *x, const SECItem *testRandom,
                              const SECItem *gxIn, SECItem *gxOut,
                              SECItem *gv, SECItem *r);

    SECStatus (*p_JPAKE_Verify)(PLArenaPool *arena, const PQGParams *pqg,
                                HASH_HashType hashType, const SECItem *signerID,
                                const SECItem *peerID, const SECItem *gx,
                                const SECItem *gv, const SECItem *r);

    SECStatus (*p_JPAKE_Round2)(PLArenaPool *arena, const SECItem *p,
                                const SECItem *q, const SECItem *gx1,
                                const SECItem *gx3, const SECItem *gx4,
                                SECItem *base, const SECItem *x2,
                                const SECItem *s, SECItem *x2s);

    SECStatus (*p_JPAKE_Final)(PLArenaPool *arena, const SECItem *p,
                               const SECItem *q, const SECItem *x2,
                               const SECItem *gx4, const SECItem *x2s,
                               const SECItem *B, SECItem *K);

    /* Version 3.012 came to here */

    SECStatus (*p_TLS_P_hash)(HASH_HashType hashAlg,
                              const SECItem *secret,
                              const char *label,
                              SECItem *seed,
                              SECItem *result,
                              PRBool isFIPS);

    SHA224Context *(*p_SHA224_NewContext)(void);
    void (*p_SHA224_DestroyContext)(SHA224Context *cx, PRBool freeit);
    void (*p_SHA224_Begin)(SHA224Context *cx);
    void (*p_SHA224_Update)(SHA224Context *cx, const unsigned char *input,
                            unsigned int inputLen);
    void (*p_SHA224_End)(SHA224Context *cx, unsigned char *digest,
                         unsigned int *digestLen, unsigned int maxDigestLen);
    SECStatus (*p_SHA224_HashBuf)(unsigned char *dest, const unsigned char *src,
                                  PRUint32 src_length);
    SECStatus (*p_SHA224_Hash)(unsigned char *dest, const char *src);
    void (*p_SHA224_TraceState)(SHA224Context *cx);
    unsigned int (*p_SHA224_FlattenSize)(SHA224Context *cx);
    SECStatus (*p_SHA224_Flatten)(SHA224Context *cx, unsigned char *space);
    SHA224Context *(*p_SHA224_Resurrect)(unsigned char *space, void *arg);
    void (*p_SHA224_Clone)(SHA224Context *dest, SHA224Context *src);
    PRBool (*p_BLAPI_SHVerifyFile)(const char *name);

    /* Version 3.013 came to here */

    SECStatus (*p_PQG_ParamGenV2)(unsigned int L, unsigned int N,
                                  unsigned int seedBytes,
                                  PQGParams **pParams, PQGVerify **pVfy);
    SECStatus (*p_PRNGTEST_RunHealthTests)(void);

    /* Version 3.014 came to here */

    SECStatus (*p_HMAC_ConstantTime)(
        unsigned char *result,
        unsigned int *resultLen,
        unsigned int maxResultLen,
        const SECHashObject *hashObj,
        const unsigned char *secret,
        unsigned int secretLen,
        const unsigned char *header,
        unsigned int headerLen,
        const unsigned char *body,
        unsigned int bodyLen,
        unsigned int bodyTotalLen);

    SECStatus (*p_SSLv3_MAC_ConstantTime)(
        unsigned char *result,
        unsigned int *resultLen,
        unsigned int maxResultLen,
        const SECHashObject *hashObj,
        const unsigned char *secret,
        unsigned int secretLen,
        const unsigned char *header,
        unsigned int headerLen,
        const unsigned char *body,
        unsigned int bodyLen,
        unsigned int bodyTotalLen);

    /* Version 3.015 came to here */

    SECStatus (*p_RSA_SignRaw)(RSAPrivateKey *key,
                               unsigned char *output,
                               unsigned int *outputLen,
                               unsigned int maxOutputLen,
                               const unsigned char *input,
                               unsigned int inputLen);
    SECStatus (*p_RSA_CheckSignRaw)(RSAPublicKey *key,
                                    const unsigned char *sig,
                                    unsigned int sigLen,
                                    const unsigned char *hash,
                                    unsigned int hashLen);
    SECStatus (*p_RSA_CheckSignRecoverRaw)(RSAPublicKey *key,
                                           unsigned char *data,
                                           unsigned int *dataLen,
                                           unsigned int maxDataLen,
                                           const unsigned char *sig,
                                           unsigned int sigLen);
    SECStatus (*p_RSA_EncryptRaw)(RSAPublicKey *key,
                                  unsigned char *output,
                                  unsigned int *outputLen,
                                  unsigned int maxOutputLen,
                                  const unsigned char *input,
                                  unsigned int inputLen);
    SECStatus (*p_RSA_DecryptRaw)(RSAPrivateKey *key,
                                  unsigned char *output,
                                  unsigned int *outputLen,
                                  unsigned int maxOutputLen,
                                  const unsigned char *input,
                                  unsigned int inputLen);
    SECStatus (*p_RSA_EncryptOAEP)(RSAPublicKey *key,
                                   HASH_HashType hashAlg,
                                   HASH_HashType maskHashAlg,
                                   const unsigned char *label,
                                   unsigned int labelLen,
                                   const unsigned char *seed,
                                   unsigned int seedLen,
                                   unsigned char *output,
                                   unsigned int *outputLen,
                                   unsigned int maxOutputLen,
                                   const unsigned char *input,
                                   unsigned int inputLen);
    SECStatus (*p_RSA_DecryptOAEP)(RSAPrivateKey *key,
                                   HASH_HashType hashAlg,
                                   HASH_HashType maskHashAlg,
                                   const unsigned char *label,
                                   unsigned int labelLen,
                                   unsigned char *output,
                                   unsigned int *outputLen,
                                   unsigned int maxOutputLen,
                                   const unsigned char *input,
                                   unsigned int inputLen);
    SECStatus (*p_RSA_EncryptBlock)(RSAPublicKey *key,
                                    unsigned char *output,
                                    unsigned int *outputLen,
                                    unsigned int maxOutputLen,
                                    const unsigned char *input,
                                    unsigned int inputLen);
    SECStatus (*p_RSA_DecryptBlock)(RSAPrivateKey *key,
                                    unsigned char *output,
                                    unsigned int *outputLen,
                                    unsigned int maxOutputLen,
                                    const unsigned char *input,
                                    unsigned int inputLen);
    SECStatus (*p_RSA_SignPSS)(RSAPrivateKey *key,
                               HASH_HashType hashAlg,
                               HASH_HashType maskHashAlg,
                               const unsigned char *salt,
                               unsigned int saltLen,
                               unsigned char *output,
                               unsigned int *outputLen,
                               unsigned int maxOutputLen,
                               const unsigned char *input,
                               unsigned int inputLen);
    SECStatus (*p_RSA_CheckSignPSS)(RSAPublicKey *key,
                                    HASH_HashType hashAlg,
                                    HASH_HashType maskHashAlg,
                                    unsigned int saltLen,
                                    const unsigned char *sig,
                                    unsigned int sigLen,
                                    const unsigned char *hash,
                                    unsigned int hashLen);
    SECStatus (*p_RSA_Sign)(RSAPrivateKey *key,
                            unsigned char *output,
                            unsigned int *outputLen,
                            unsigned int maxOutputLen,
                            const unsigned char *input,
                            unsigned int inputLen);
    SECStatus (*p_RSA_CheckSign)(RSAPublicKey *key,
                                 const unsigned char *sig,
                                 unsigned int sigLen,
                                 const unsigned char *data,
                                 unsigned int dataLen);
    SECStatus (*p_RSA_CheckSignRecover)(RSAPublicKey *key,
                                        unsigned char *output,
                                        unsigned int *outputLen,
                                        unsigned int maxOutputLen,
                                        const unsigned char *sig,
                                        unsigned int sigLen);

    /* Version 3.016 came to here */

    SECStatus (*p_EC_FillParams)(PLArenaPool *arena,
                                 const SECItem *encodedParams, ECParams *params);
    SECStatus (*p_EC_DecodeParams)(const SECItem *encodedParams,
                                   ECParams **ecparams);
    SECStatus (*p_EC_CopyParams)(PLArenaPool *arena, ECParams *dstParams,
                                 const ECParams *srcParams);

    /* Version 3.017 came to here */

    SECStatus (*p_ChaCha20Poly1305_InitContext)(ChaCha20Poly1305Context *ctx,
                                                const unsigned char *key,
                                                unsigned int keyLen,
                                                unsigned int tagLen);

    ChaCha20Poly1305Context *(*p_ChaCha20Poly1305_CreateContext)(
        const unsigned char *key, unsigned int keyLen, unsigned int tagLen);

    void (*p_ChaCha20Poly1305_DestroyContext)(ChaCha20Poly1305Context *ctx,
                                              PRBool freeit);

    SECStatus (*p_ChaCha20Poly1305_Seal)(
        const ChaCha20Poly1305Context *ctx, unsigned char *output,
        unsigned int *outputLen, unsigned int maxOutputLen,
        const unsigned char *input, unsigned int inputLen,
        const unsigned char *nonce, unsigned int nonceLen,
        const unsigned char *ad, unsigned int adLen);

    SECStatus (*p_ChaCha20Poly1305_Open)(
        const ChaCha20Poly1305Context *ctx, unsigned char *output,
        unsigned int *outputLen, unsigned int maxOutputLen,
        const unsigned char *input, unsigned int inputLen,
        const unsigned char *nonce, unsigned int nonceLen,
        const unsigned char *ad, unsigned int adLen);

    /* Version 3.018 came to here */

    int (*p_EC_GetPointSize)(const ECParams *);

    /* Version 3.019 came to here */

    SECStatus (*p_BLAKE2B_Hash)(unsigned char *dest, const char *src);
    SECStatus (*p_BLAKE2B_HashBuf)(unsigned char *output,
                                   const unsigned char *input, PRUint32 inlen);
    SECStatus (*p_BLAKE2B_MAC_HashBuf)(unsigned char *output,
                                       const unsigned char *input,
                                       unsigned int inlen,
                                       const unsigned char *key,
                                       unsigned int keylen);
    BLAKE2BContext *(*p_BLAKE2B_NewContext)();
    void (*p_BLAKE2B_DestroyContext)(BLAKE2BContext *ctx, PRBool freeit);
    SECStatus (*p_BLAKE2B_Begin)(BLAKE2BContext *ctx);
    SECStatus (*p_BLAKE2B_MAC_Begin)(BLAKE2BContext *ctx, const PRUint8 *key,
                                     const size_t keylen);
    SECStatus (*p_BLAKE2B_Update)(BLAKE2BContext *ctx, const unsigned char *in,
                                  unsigned int inlen);
    SECStatus (*p_BLAKE2B_End)(BLAKE2BContext *ctx, unsigned char *out,
                               unsigned int *digestLen, size_t maxDigestLen);
    unsigned int (*p_BLAKE2B_FlattenSize)(BLAKE2BContext *ctx);
    SECStatus (*p_BLAKE2B_Flatten)(BLAKE2BContext *ctx, unsigned char *space);
    BLAKE2BContext *(*p_BLAKE2B_Resurrect)(unsigned char *space, void *arg);

    /* Version 3.020 came to here */

    /* Add new function pointers at the end of this struct and bump
     * FREEBL_VERSION at the beginning of this file. */
};

typedef struct FREEBLVectorStr FREEBLVector;

#ifdef FREEBL_LOWHASH
#include "nsslowhash.h"

#define NSSLOW_VERSION 0x0300

struct NSSLOWVectorStr {
    unsigned short length;  /* of this struct in bytes */
    unsigned short version; /* of this struct. */
    const FREEBLVector *(*p_FREEBL_GetVector)(void);
    NSSLOWInitContext *(*p_NSSLOW_Init)(void);
    void (*p_NSSLOW_Shutdown)(NSSLOWInitContext *context);
    void (*p_NSSLOW_Reset)(NSSLOWInitContext *context);
    NSSLOWHASHContext *(*p_NSSLOWHASH_NewContext)(
        NSSLOWInitContext *initContext,
        HASH_HashType hashType);
    void (*p_NSSLOWHASH_Begin)(NSSLOWHASHContext *context);
    void (*p_NSSLOWHASH_Update)(NSSLOWHASHContext *context,
                                const unsigned char *buf,
                                unsigned int len);
    void (*p_NSSLOWHASH_End)(NSSLOWHASHContext *context,
                             unsigned char *buf,
                             unsigned int *ret, unsigned int len);
    void (*p_NSSLOWHASH_Destroy)(NSSLOWHASHContext *context);
    unsigned int (*p_NSSLOWHASH_Length)(NSSLOWHASHContext *context);
};

typedef struct NSSLOWVectorStr NSSLOWVector;
#endif

SEC_BEGIN_PROTOS

#ifdef FREEBL_LOWHASH
typedef const NSSLOWVector *NSSLOWGetVectorFn(void);

extern NSSLOWGetVectorFn NSSLOW_GetVector;
#endif

typedef const FREEBLVector *FREEBLGetVectorFn(void);

extern FREEBLGetVectorFn FREEBL_GetVector;

SEC_END_PROTOS

#endif