Coverage Report

Created: 2024-11-21 07:03

/src/SymCrypt/lib/a_dispatch.c
Line
Count
Source (jump to first uncovered line)
1
//
2
// a_dispatch.c   Dispatch between different arithmetic format implementations.
3
//
4
// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
5
//
6
// SymCrypt can have multiple implementations of the arithmetic operations, and these can
7
// have incompatible formats used to store the integers.
8
// This file contains logic to dispatch between these incompatible formats.
9
// Currently all implementations use the default format, or "Fdef".
10
//
11
12
#include "precomp.h"
13
14
//
15
// Define the FDEF dispatch table here.
16
// This should eventually be split out so that different users of the library can use different
17
// table sets & implementation choice functions.
18
//
19
20
21
const SYMCRYPT_MODULAR_FUNCTIONS g_SymCryptModFns[] = {
22
    SYMCRYPT_MOD_FUNCTIONS_FDEF_GENERIC,                // Handles any type of modulus
23
    SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY,             // Montgomery, only for odd parity-public moduli
24
25
#if SYMCRYPT_CPU_AMD64
26
27
    SYMCRYPT_MOD_FUNCTIONS_FDEF369_MONTGOMERY,          // optimized for 384 and 576-bit moduli
28
    SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_MULX256,     // Special faster code for 256-bit Montgomery moduli, MULX-based code
29
    SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_MULXP384,    // Special faster code for P-384 field modulus, MULX-based code
30
    SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_MULX,        // MULX-based code, for any size (digit size = 512 bits)
31
    SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_MULX1024,    // Special faster code for 1024-bit Montgomery moduli, MULX-based code
32
    {NULL,},
33
34
    // SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_MULXP256,    // Special faster code for P-256 field modulus, MULX-based code
35
    // SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_MULX384,     // Special faster code for 384-bit Montgomery moduli, MULX-based code
36
    // SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY256,          // Special faster code for 256-bit Montgomery moduli
37
    // SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY512,          // Special faster code for 512-bit Montgomery moduli
38
    // SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY1024,         // Special faster code for 1024-bit Montgomery moduli
39
40
#elif SYMCRYPT_CPU_ARM64
41
42
    SYMCRYPT_MOD_FUNCTIONS_FDEF369_MONTGOMERY,
43
    SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_ARM64256,
44
    SYMCRYPT_MOD_FUNCTIONS_FDEF_MONTGOMERY_ARM64P384,
45
    {NULL,},
46
    {NULL,},
47
    {NULL,},
48
49
#endif
50
};
51
52
#define SymCryptModLabel(_label)                (_label << 16)
53
#define SymCryptModFntableGeneric               (SymCryptModLabel('gM') + (0 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
54
#define SymCryptModFntableMontgomery            (SymCryptModLabel('mM') + (1 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
55
#define SymCryptModFntable369Montgomery         (SymCryptModLabel('9m') + (2 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
56
#define SymCryptModFntableMontgomeryMulx256     (SymCryptModLabel('2x') + (3 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
57
#define SymCryptModFntableMontgomeryMulxP384    (SymCryptModLabel('3n') + (4 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
58
#define SymCryptModFntableMontgomeryMulx        (SymCryptModLabel('xM') + (5 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
59
#define SymCryptModFntableMontgomeryMulx1024    (SymCryptModLabel('1x') + (6 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
60
61
#define SymCryptModFntableMontgomeryArm64256    (SymCryptModLabel('2m') + (3 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
62
#define SymCryptModFntableMontgomeryArm64P384   (SymCryptModLabel('3n') + (4 * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
63
64
// #define SymCryptModFntableMontgomeryMulxP256    (SymCryptModLabel('2n') + (xx * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
65
// #define SymCryptModFntableMontgomeryMulx384     (SymCryptModLabel('3x') + (xx * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
66
// #define SymCryptModFntableMontgomery256         (SymCryptModLabel('2m') + (xx * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
67
// #define SymCryptModFntableMontgomery512         (SymCryptModLabel('5m') + (xx * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
68
// #define SymCryptModFntableMontgomery1024        (SymCryptModLabel('1m') + (xx * SYMCRYPT_MODULAR_FUNCTIONS_SIZE))
69
70
C_ASSERT( (sizeof( g_SymCryptModFns ) & (sizeof( g_SymCryptModFns) - 1 )) == 0 ); // size of the table must be a power of 2 to be CFG-safe.
71
72
const UINT32 g_SymCryptModFnsMask = sizeof( g_SymCryptModFns ) - sizeof( g_SymCryptModFns[0] );
73
74
//
75
// Tweaking the selection & function tables allows different tradeoffs of performance vs codesize
76
//
77
const SYMCRYPT_MODULUS_TYPE_SELECTION_ENTRY SymCryptModulusTypeSelections[] =
78
{
79
#if SYMCRYPT_CPU_AMD64
80
    // Mulx used for 0-512 and 577-... bits
81
    {SymCryptModFntableMontgomeryMulxP384,  SYMCRYPT_CPU_FEATURES_FOR_MULX,  384,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY | SYMCRYPT_MODULUS_FEATURE_NISTP384 },
82
    {SymCryptModFntableMontgomeryMulx256,   SYMCRYPT_CPU_FEATURES_FOR_MULX,  256,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
83
    {SymCryptModFntableMontgomeryMulx,      SYMCRYPT_CPU_FEATURES_FOR_MULX,  512,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
84
    {SymCryptModFntable369Montgomery,       0,                               384,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
85
    {SymCryptModFntableMontgomery,          0,                               512,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
86
    {SymCryptModFntable369Montgomery,       0,                               576,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
87
    {SymCryptModFntableMontgomeryMulx1024,  SYMCRYPT_CPU_FEATURES_FOR_MULX, 1024,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
88
    {SymCryptModFntableMontgomeryMulx,      SYMCRYPT_CPU_FEATURES_FOR_MULX,    0,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
89
90
#elif SYMCRYPT_CPU_ARM64
91
92
    {SymCryptModFntableMontgomeryArm64P384, 0,                               384,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY | SYMCRYPT_MODULUS_FEATURE_NISTP384 },
93
    {SymCryptModFntableMontgomeryArm64256,  0,                               256,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
94
    {SymCryptModFntable369Montgomery,       0,                               384,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
95
    {SymCryptModFntableMontgomery,          0,                               512,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
96
    {SymCryptModFntable369Montgomery,       0,                               576,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
97
98
#endif
99
100
    {SymCryptModFntableMontgomery,          0,                                 0,   SYMCRYPT_MODULUS_FEATURE_MONTGOMERY },
101
    {SymCryptModFntableGeneric,             0,                                 0,   0 },
102
    // This last entry always matches, so the code never falls off the end of this table.
103
};
104
105
106
//
107
// At the moment there is only the default number format.
108
//
109
110
UINT32
111
SymCryptDigitsFromBits( UINT32 nBits )
112
15.1k
{
113
15.1k
    return SymCryptFdefDigitsFromBits( nBits );
114
15.1k
}
115
116
117
PSYMCRYPT_INT
118
SYMCRYPT_CALL
119
SymCryptIntAllocate( UINT32 nDigits )
120
196
{
121
196
    return SymCryptFdefIntAllocate( nDigits );
122
196
}
123
124
VOID
125
SYMCRYPT_CALL
126
SymCryptIntFree( _Out_ PSYMCRYPT_INT piObj )
127
196
{
128
196
    SymCryptIntWipe( piObj );
129
196
    SymCryptCallbackFree( piObj );
130
196
}
131
132
UINT32
133
SYMCRYPT_CALL
134
SymCryptSizeofIntFromDigits( UINT32 nDigits )
135
12.8k
{
136
12.8k
    return SymCryptFdefSizeofIntFromDigits( nDigits );
137
12.8k
}
138
139
PSYMCRYPT_INT
140
SYMCRYPT_CALL
141
SymCryptIntCreate(
142
    _Out_writes_bytes_( cbBuffer )  PBYTE   pbBuffer,
143
                                    SIZE_T  cbBuffer,
144
                                    UINT32  nDigits )
145
12.8k
{
146
12.8k
    return SymCryptFdefIntCreate( pbBuffer, cbBuffer, nDigits );
147
12.8k
}
148
149
VOID
150
SYMCRYPT_CALL
151
SymCryptIntWipe( _Out_ PSYMCRYPT_INT piDst )
152
196
{
153
196
    SYMCRYPT_CHECK_MAGIC( piDst );
154
155
    // Wipe the whole structure in one go;
156
196
    SymCryptWipe( piDst, piDst->cbSize );
157
196
}
158
159
VOID
160
SYMCRYPT_CALL
161
SymCryptIntCopy(
162
    _In_    PCSYMCRYPT_INT  piSrc,
163
    _Out_   PSYMCRYPT_INT   piDst )
164
185k
{
165
185k
    SymCryptFdefIntCopy( piSrc, piDst );
166
185k
}
167
168
VOID
169
SYMCRYPT_CALL
170
SymCryptIntMaskedCopy(
171
    _In_    PCSYMCRYPT_INT  piSrc,
172
    _Inout_ PSYMCRYPT_INT   piDst,
173
            UINT32          mask )
174
60.5k
{
175
60.5k
    SymCryptFdefIntMaskedCopy( piSrc, piDst, mask );
176
60.5k
}
177
178
VOID
179
SYMCRYPT_CALL
180
SymCryptIntConditionalCopy(
181
    _In_    PCSYMCRYPT_INT  piSrc,
182
    _Inout_ PSYMCRYPT_INT   piDst,
183
            UINT32          cond )
184
0
{
185
0
    SymCryptFdefIntConditionalCopy( piSrc, piDst, cond );
186
0
}
187
188
VOID
189
SYMCRYPT_CALL
190
SymCryptIntConditionalSwap(
191
    _Inout_ PSYMCRYPT_INT   piSrc1,
192
    _Inout_ PSYMCRYPT_INT   piSrc2,
193
            UINT32          cond )
194
0
{
195
0
    SymCryptFdefIntConditionalSwap( piSrc1, piSrc2, cond );
196
0
}
197
198
UINT32
199
SYMCRYPT_CALL
200
SymCryptIntBitsizeOfObject( _In_ PCSYMCRYPT_INT  piSrc )
201
0
{
202
0
    return SymCryptFdefIntBitsizeOfObject( piSrc );
203
0
}
204
205
UINT32
206
SYMCRYPT_CALL
207
SymCryptIntDigitsizeOfObject( _In_ PCSYMCRYPT_INT piSrc )
208
0
{
209
0
    return piSrc->nDigits;
210
0
}
211
212
SYMCRYPT_ERROR
213
SYMCRYPT_CALL
214
SymCryptIntCopyMixedSize(
215
    _In_    PCSYMCRYPT_INT  piSrc,
216
    _Out_   PSYMCRYPT_INT   piDst )
217
0
{
218
0
    return SymCryptFdefIntCopyMixedSize( piSrc, piDst );
219
0
}
220
221
UINT32
222
SYMCRYPT_CALL
223
SymCryptIntBitsizeOfValue( _In_ PCSYMCRYPT_INT piSrc )
224
6.62k
{
225
6.62k
    return SymCryptFdefIntBitsizeOfValue( piSrc );
226
6.62k
}
227
228
VOID
229
SYMCRYPT_CALL
230
SymCryptIntSetValueUint32(
231
            UINT32          u32Src,
232
    _Out_   PSYMCRYPT_INT   piDst )
233
0
{
234
0
    SymCryptFdefIntSetValueUint32( u32Src, piDst );
235
0
}
236
237
VOID
238
SYMCRYPT_CALL
239
SymCryptIntSetValueUint64(
240
            UINT64          u64Src,
241
    _Out_   PSYMCRYPT_INT   piDst )
242
0
{
243
0
    SymCryptFdefIntSetValueUint64( u64Src, piDst );
244
0
}
245
246
SYMCRYPT_ERROR
247
SYMCRYPT_CALL
248
SymCryptIntSetValue(
249
    _In_reads_bytes_(cbSrc)     PCBYTE                  pbSrc,
250
                                SIZE_T                  cbSrc,
251
                                SYMCRYPT_NUMBER_FORMAT  format,
252
    _Out_                       PSYMCRYPT_INT           piDst )
253
6.90k
{
254
6.90k
    return SymCryptFdefIntSetValue( pbSrc, cbSrc, format, piDst );
255
6.90k
}
256
257
SYMCRYPT_ERROR
258
SYMCRYPT_CALL
259
SymCryptIntGetValue(
260
    _In_                        PCSYMCRYPT_INT          piSrc,
261
    _Out_writes_bytes_( cbDst ) PBYTE                   pbDst,
262
                                SIZE_T                  cbDst,
263
                                SYMCRYPT_NUMBER_FORMAT  format )
264
0
{
265
0
    return SymCryptFdefIntGetValue( piSrc, pbDst, cbDst, format );
266
0
}
267
268
UINT32
269
SYMCRYPT_CALL
270
SymCryptIntGetValueLsbits32( _In_  PCSYMCRYPT_INT piSrc )
271
885k
{
272
885k
    return SymCryptFdefIntGetValueLsbits32( piSrc );
273
885k
}
274
275
UINT64
276
SYMCRYPT_CALL
277
SymCryptIntGetValueLsbits64( _In_  PCSYMCRYPT_INT piSrc )
278
1.89k
{
279
1.89k
    return SymCryptFdefIntGetValueLsbits64( piSrc );
280
1.89k
}
281
282
UINT32
283
SYMCRYPT_CALL
284
SymCryptIntAddUint32(
285
    _In_    PCSYMCRYPT_INT  piSrc1,
286
            UINT32          u32Src2,
287
    _Out_   PSYMCRYPT_INT   piDst )
288
69.6k
{
289
69.6k
    return SymCryptFdefIntAddUint32( piSrc1, u32Src2, piDst );
290
69.6k
}
291
292
UINT32
293
SYMCRYPT_CALL
294
SymCryptIntAddSameSize(
295
    _In_    PCSYMCRYPT_INT piSrc1,
296
    _In_    PCSYMCRYPT_INT piSrc2,
297
    _Out_   PSYMCRYPT_INT  piDst )
298
0
{
299
0
    return SymCryptFdefIntAddSameSize( piSrc1, piSrc2, piDst );
300
0
}
301
302
UINT32
303
SYMCRYPT_CALL
304
SymCryptIntAddMixedSize(
305
    _In_    PCSYMCRYPT_INT piSrc1,
306
    _In_    PCSYMCRYPT_INT piSrc2,
307
    _Out_   PSYMCRYPT_INT  piDst )
308
0
{
309
0
    return SymCryptFdefIntAddMixedSize( piSrc1, piSrc2, piDst );
310
0
}
311
312
UINT32
313
SYMCRYPT_CALL
314
SymCryptIntSubUint32(
315
    _In_    PCSYMCRYPT_INT  piSrc1,
316
            UINT32          u32Src2,
317
    _Out_   PSYMCRYPT_INT   piDst )
318
70.1k
{
319
70.1k
    return SymCryptFdefIntSubUint32( piSrc1, u32Src2, piDst );
320
70.1k
}
321
322
UINT32
323
SYMCRYPT_CALL
324
SymCryptIntSubSameSize(
325
    _In_    PCSYMCRYPT_INT piSrc1,
326
    _In_    PCSYMCRYPT_INT piSrc2,
327
    _Out_   PSYMCRYPT_INT  piDst )
328
337k
{
329
337k
    return SymCryptFdefIntSubSameSize( piSrc1, piSrc2, piDst );
330
337k
}
331
332
UINT32
333
SYMCRYPT_CALL
334
SymCryptIntSubMixedSize(
335
    _In_    PCSYMCRYPT_INT piSrc1,
336
    _In_    PCSYMCRYPT_INT piSrc2,
337
    _Out_   PSYMCRYPT_INT  piDst )
338
0
{
339
0
    return SymCryptFdefIntSubMixedSize( piSrc1, piSrc2, piDst );
340
0
}
341
342
VOID
343
SYMCRYPT_CALL
344
SymCryptIntNeg(
345
    _In_    PCSYMCRYPT_INT  piSrc,
346
    _Out_   PSYMCRYPT_INT   piDst )
347
153k
{
348
153k
    SymCryptFdefIntNeg( piSrc, piDst );
349
153k
}
350
351
352
VOID
353
SYMCRYPT_CALL
354
SymCryptIntMulPow2(
355
    _In_    PCSYMCRYPT_INT  piSrc,
356
            SIZE_T          exp,
357
    _Out_   PSYMCRYPT_INT   piDst )
358
0
{
359
0
    SymCryptFdefIntMulPow2( piSrc, exp, piDst );
360
0
}
361
362
VOID
363
SYMCRYPT_CALL
364
SymCryptIntDivPow2(
365
    _In_    PCSYMCRYPT_INT  piSrc,
366
            SIZE_T          exp,
367
    _Out_   PSYMCRYPT_INT   piDst )
368
538k
{
369
538k
    SymCryptFdefIntDivPow2( piSrc, exp, piDst );
370
538k
}
371
372
VOID
373
SYMCRYPT_CALL
374
SymCryptIntShr1(
375
            UINT32          highestBit,
376
    _In_    PCSYMCRYPT_INT  piSrc,
377
    _Out_   PSYMCRYPT_INT   piDst )
378
0
{
379
0
    SymCryptFdefIntShr1( highestBit, piSrc, piDst );
380
0
}
381
382
VOID
383
SYMCRYPT_CALL
384
SymCryptIntModPow2(
385
    _In_    PCSYMCRYPT_INT  piSrc,
386
            SIZE_T          exp,
387
    _Out_   PSYMCRYPT_INT   piDst )
388
0
{
389
0
    SymCryptFdefIntModPow2( piSrc, exp, piDst );
390
0
}
391
392
UINT32
393
SYMCRYPT_CALL
394
SymCryptIntGetBit(
395
    _In_    PCSYMCRYPT_INT  piSrc,
396
            UINT32          iBit )
397
795
{
398
795
    return SymCryptFdefIntGetBit( piSrc, iBit );
399
795
}
400
401
UINT32
402
SYMCRYPT_CALL
403
SymCryptIntGetBits(
404
    _In_    PCSYMCRYPT_INT  piSrc,
405
            UINT32          iBit,
406
            UINT32          nBits )
407
0
{
408
0
    return SymCryptFdefIntGetBits( piSrc, iBit, nBits );
409
0
}
410
411
VOID
412
SYMCRYPT_CALL
413
SymCryptIntSetBits(
414
    _In_    PSYMCRYPT_INT   piDst,
415
            UINT32          value,
416
            UINT32          iBit,
417
            UINT32          nBits )
418
0
{
419
0
    SymCryptFdefIntSetBits( piDst, value, iBit, nBits );
420
0
}
421
422
UINT32
423
SYMCRYPT_CALL
424
SymCryptIntIsEqualUint32(
425
    _In_    PCSYMCRYPT_INT  piSrc1,
426
    _In_    UINT32          u32Src2 )
427
683k
{
428
683k
    return SymCryptFdefIntIsEqualUint32( piSrc1, u32Src2 );
429
683k
}
430
431
UINT32
432
SYMCRYPT_CALL
433
SymCryptIntIsEqual(
434
    _In_    PCSYMCRYPT_INT  piSrc1,
435
    _In_    PCSYMCRYPT_INT  piSrc2 )
436
0
{
437
0
    return SymCryptFdefIntIsEqual( piSrc1, piSrc2 );
438
0
}
439
440
UINT32
441
SYMCRYPT_CALL
442
SymCryptIntIsLessThan(
443
    _In_    PCSYMCRYPT_INT  piSrc1,
444
    _In_    PCSYMCRYPT_INT  piSrc2 )
445
4.22k
{
446
4.22k
    return SymCryptFdefIntIsLessThan( piSrc1, piSrc2 );
447
4.22k
}
448
449
UINT32
450
SYMCRYPT_CALL
451
SymCryptIntMulUint32(
452
    _In_                            PCSYMCRYPT_INT  piSrc1,
453
                                    UINT32          Src2,
454
    _Out_                           PSYMCRYPT_INT   piDst )
455
0
{
456
0
    return SymCryptFdefIntMulUint32( piSrc1, Src2, piDst );
457
0
}
458
459
VOID
460
SYMCRYPT_CALL
461
SymCryptIntMulSameSize(
462
    _In_                            PCSYMCRYPT_INT  piSrc1,
463
    _In_                            PCSYMCRYPT_INT  piSrc2,
464
    _Out_                           PSYMCRYPT_INT   piDst,
465
    _Out_writes_bytes_( cbScratch ) PBYTE           pbScratch,
466
                                    SIZE_T          cbScratch )
467
0
{
468
0
    SymCryptFdefIntMulSameSize( piSrc1, piSrc2, piDst, pbScratch, cbScratch );
469
0
}
470
471
472
VOID
473
SYMCRYPT_CALL
474
SymCryptIntSquare(
475
    _In_                            PCSYMCRYPT_INT  piSrc,
476
    _Out_                           PSYMCRYPT_INT   piDst,
477
    _Out_writes_bytes_( cbScratch ) PBYTE           pbScratch,
478
                                    SIZE_T          cbScratch )
479
0
{
480
0
    SymCryptFdefIntSquare( piSrc, piDst, pbScratch, cbScratch );
481
0
}
482
483
VOID
484
SYMCRYPT_CALL
485
SymCryptIntMulMixedSize(
486
    _In_                            PCSYMCRYPT_INT  piSrc1,
487
    _In_                            PCSYMCRYPT_INT  piSrc2,
488
    _Out_                           PSYMCRYPT_INT   piDst,
489
    _Out_writes_bytes_( cbScratch ) PBYTE           pbScratch,
490
                                    SIZE_T          cbScratch )
491
0
{
492
0
    SymCryptFdefIntMulMixedSize( piSrc1, piSrc2, piDst, pbScratch, cbScratch );
493
0
}
494
495
PSYMCRYPT_DIVISOR
496
SYMCRYPT_CALL
497
SymCryptDivisorAllocate( UINT32 nDigits )
498
0
{
499
0
    return SymCryptFdefDivisorAllocate( nDigits );
500
0
}
501
502
VOID
503
SYMCRYPT_CALL
504
SymCryptDivisorFree( _Out_ PSYMCRYPT_DIVISOR pdObj )
505
0
{
506
0
    SymCryptDivisorWipe( pdObj );
507
0
    SymCryptCallbackFree( pdObj );
508
0
}
509
510
UINT32
511
SYMCRYPT_CALL
512
SymCryptSizeofDivisorFromDigits( UINT32 nDigits )
513
1.89k
{
514
1.89k
    return SymCryptFdefSizeofDivisorFromDigits( nDigits );
515
1.89k
}
516
517
PSYMCRYPT_DIVISOR
518
SYMCRYPT_CALL
519
SymCryptDivisorCreate(
520
    _Out_writes_bytes_( cbBuffer )  PBYTE   pbBuffer,
521
                                    SIZE_T  cbBuffer,
522
                                    UINT32  nDigits )
523
0
{
524
0
    return SymCryptFdefDivisorCreate( pbBuffer, cbBuffer, nDigits );
525
0
}
526
527
VOID
528
SYMCRYPT_CALL
529
SymCryptDivisorWipe( _Out_ PSYMCRYPT_DIVISOR pdObj )
530
0
{
531
0
    SYMCRYPT_CHECK_MAGIC( pdObj );
532
533
0
    SymCryptWipe( pdObj, pdObj->cbSize );
534
0
}
535
536
VOID
537
SymCryptDivisorCopy(
538
    _In_    PCSYMCRYPT_DIVISOR  pdSrc,
539
    _Out_   PSYMCRYPT_DIVISOR   pdDst )
540
0
{
541
0
    SymCryptFdefDivisorCopy( pdSrc, pdDst );
542
0
}
543
544
UINT32
545
SYMCRYPT_CALL
546
SymCryptDivisorDigitsizeOfObject( _In_ PCSYMCRYPT_DIVISOR pdSrc )
547
0
{
548
0
    return pdSrc->nDigits;
549
0
}
550
551
PSYMCRYPT_INT
552
SYMCRYPT_CALL
553
SymCryptIntFromDivisor( _In_ PSYMCRYPT_DIVISOR pdSrc )
554
0
{
555
0
    return SymCryptFdefIntFromDivisor( pdSrc );
556
0
}
557
558
VOID
559
SYMCRYPT_CALL
560
SymCryptIntToDivisor(
561
    _In_                            PCSYMCRYPT_INT      piSrc,
562
    _Out_                           PSYMCRYPT_DIVISOR   pdDst,
563
                                    UINT32              totalOperations,
564
                                    UINT32              flags,
565
    _Out_writes_bytes_( cbScratch ) PBYTE               pbScratch,
566
                                    SIZE_T              cbScratch )
567
1.89k
{
568
1.89k
    SymCryptFdefIntToDivisor( piSrc, pdDst, totalOperations, flags, pbScratch, cbScratch );
569
1.89k
}
570
571
VOID
572
SYMCRYPT_CALL
573
SymCryptIntDivMod(
574
    _In_                            PCSYMCRYPT_INT      piSrc,
575
    _In_                            PCSYMCRYPT_DIVISOR  pdDivisor,
576
    _Out_opt_                       PSYMCRYPT_INT       piQuotient,
577
    _Out_opt_                       PSYMCRYPT_INT       piRemainder,
578
    _Out_writes_bytes_( cbScratch ) PBYTE               pbScratch,
579
                                    SIZE_T              cbScratch )
580
603
{
581
603
    SymCryptFdefIntDivMod( piSrc, pdDivisor, piQuotient, piRemainder, pbScratch, cbScratch );
582
603
}
583
584
585
PSYMCRYPT_MODULUS
586
SYMCRYPT_CALL
587
SymCryptModulusAllocate( UINT32 nDigits )
588
0
{
589
0
    return SymCryptFdefModulusAllocate( nDigits );
590
0
}
591
592
VOID
593
SYMCRYPT_CALL
594
SymCryptModulusFree( _Out_ PSYMCRYPT_MODULUS pmObj )
595
0
{
596
0
    SymCryptFdefModulusFree( pmObj );
597
0
}
598
599
UINT32
600
SYMCRYPT_CALL
601
SymCryptSizeofModulusFromDigits( UINT32 nDigits )
602
1.89k
{
603
1.89k
    return SymCryptFdefSizeofModulusFromDigits( nDigits );
604
1.89k
}
605
606
PSYMCRYPT_MODULUS
607
SYMCRYPT_CALL
608
SymCryptModulusCreate(
609
    _Out_writes_bytes_( cbBuffer )  PBYTE   pbBuffer,
610
                                    SIZE_T  cbBuffer,
611
                                    UINT32  nDigits )
612
1.89k
{
613
1.89k
    return SymCryptFdefModulusCreate( pbBuffer, cbBuffer, nDigits );
614
1.89k
}
615
616
VOID
617
SYMCRYPT_CALL
618
SymCryptModulusWipe( _Out_ PSYMCRYPT_MODULUS pmObj )
619
0
{
620
0
    SYMCRYPT_CHECK_MAGIC( pmObj );
621
622
0
    SymCryptWipe( pmObj, pmObj->cbSize );
623
0
}
624
625
VOID
626
SymCryptModulusCopy(
627
    _In_    PCSYMCRYPT_MODULUS  pmSrc,
628
    _Out_   PSYMCRYPT_MODULUS   pmDst )
629
0
{
630
0
    SymCryptFdefModulusCopy( pmSrc, pmDst );
631
0
}
632
633
UINT32
634
SYMCRYPT_CALL
635
SymCryptModulusDigitsizeOfObject( _In_ PCSYMCRYPT_MODULUS pmSrc )
636
0
{
637
0
    return pmSrc->nDigits;
638
0
}
639
640
PSYMCRYPT_MODELEMENT
641
SYMCRYPT_CALL
642
SymCryptModElementAllocate( _In_ PCSYMCRYPT_MODULUS pmMod )
643
0
{
644
0
    return SymCryptFdefModElementAllocate( pmMod );
645
0
}
646
647
VOID
648
SYMCRYPT_CALL
649
SymCryptModElementFree(
650
    _In_    PCSYMCRYPT_MODULUS      pmMod,
651
    _Out_   PSYMCRYPT_MODELEMENT    peObj )
652
0
{
653
0
    SymCryptFdefModElementFree( pmMod, peObj );
654
0
}
655
656
UINT32
657
SYMCRYPT_CALL
658
SymCryptSizeofModElementFromModulus( PCSYMCRYPT_MODULUS pmMod )
659
81.5k
{
660
81.5k
    return SymCryptFdefSizeofModElementFromModulus( pmMod );
661
81.5k
}
662
663
PSYMCRYPT_MODELEMENT
664
SYMCRYPT_CALL
665
SymCryptModElementCreate(
666
    _Out_writes_bytes_( cbBuffer )  PBYTE               pbBuffer,
667
                                    SIZE_T              cbBuffer,
668
    _In_                            PCSYMCRYPT_MODULUS  pmMod )
669
2.34M
{
670
2.34M
    return SymCryptFdefModElementCreate( pbBuffer, cbBuffer, pmMod );
671
2.34M
}
672
673
VOID
674
SYMCRYPT_CALL
675
SymCryptModElementWipe(
676
    _In_    PCSYMCRYPT_MODULUS      pmMod,
677
    _Out_   PSYMCRYPT_MODELEMENT    peDst )
678
0
{
679
0
    SymCryptFdefModElementWipe( pmMod, peDst );
680
0
}
681
682
VOID
683
SymCryptModElementCopy(
684
    _In_    PCSYMCRYPT_MODULUS      pmMod,
685
    _In_    PCSYMCRYPT_MODELEMENT   peSrc,
686
    _Out_   PSYMCRYPT_MODELEMENT    peDst )
687
57.5k
{
688
57.5k
    SymCryptFdefModElementCopy( pmMod, peSrc, peDst );
689
57.5k
}
690
691
VOID
692
SymCryptModElementMaskedCopy(
693
    _In_    PCSYMCRYPT_MODULUS      pmMod,
694
    _In_    PCSYMCRYPT_MODELEMENT   peSrc,
695
    _Out_   PSYMCRYPT_MODELEMENT    peDst,
696
            UINT32                  mask )
697
82.7k
{
698
82.7k
    SymCryptFdefModElementMaskedCopy( pmMod, peSrc, peDst, mask );
699
82.7k
}
700
701
PSYMCRYPT_DIVISOR
702
SYMCRYPT_CALL
703
SymCryptDivisorFromModulus( _In_ PSYMCRYPT_MODULUS pmSrc )
704
603
{
705
603
    return SymCryptFdefDivisorFromModulus( pmSrc );
706
603
}
707
708
VOID
709
SymCryptModElementConditionalSwap(
710
    _In_     PCSYMCRYPT_MODULUS    pmMod,
711
    _Inout_  PSYMCRYPT_MODELEMENT  peData1,
712
    _Inout_  PSYMCRYPT_MODELEMENT  peData2,
713
    _In_     UINT32                cond )
714
0
{
715
0
     SymCryptFdefModElementConditionalSwap( pmMod, peData1, peData2, cond );
716
0
}
717
718
PSYMCRYPT_INT
719
SYMCRYPT_CALL
720
SymCryptIntFromModulus( _In_ PSYMCRYPT_MODULUS pmSrc )
721
8.22k
{
722
8.22k
    return SymCryptFdefIntFromModulus( pmSrc );
723
8.22k
}
724
725
VOID
726
SYMCRYPT_CALL
727
SymCryptIntToModulus(
728
    _In_                            PCSYMCRYPT_INT      piSrc,
729
    _Out_                           PSYMCRYPT_MODULUS   pmDst,
730
                                    UINT32              averageOperations,
731
                                    UINT32              flags,
732
    _Out_writes_bytes_( cbScratch ) PBYTE               pbScratch,
733
                                    SIZE_T              cbScratch )
734
1.89k
{
735
1.89k
    PSYMCRYPT_INT piSrcTweak = (PSYMCRYPT_INT) piSrc;
736
737
    // In CHKed build, we'll verify that the modulus is not prime, or that it is 2 or odd
738
    // (Some inversion algorithms fail hard when one input isn't 2 or odd.)
739
    // We are constant-time w.r.t. piSrc being odd or =2. We don't hide the size of any input,
740
    // but inputs 2 and 3 are handled with the same code path.
741
1.89k
    SYMCRYPT_ASSERT( ((flags & SYMCRYPT_FLAG_MODULUS_PRIME) == 0) ||
742
1.89k
        (((SymCryptIntGetValueLsbits32( piSrc ) & 1) | SymCryptIntIsEqualUint32( piSrc, 2 )) != 0) );
743
744
1.89k
    SymCryptFdefIntToModulus( piSrcTweak, pmDst, averageOperations, flags, pbScratch, cbScratch );
745
1.89k
}
746
747
VOID
748
SYMCRYPT_CALL
749
SymCryptIntToModElement(
750
    _In_                            PCSYMCRYPT_INT          piSrc,
751
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
752
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
753
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
754
                                    SIZE_T                  cbScratch )
755
1.17k
{
756
1.17k
    SymCryptFdefIntToModElement( piSrc, pmMod, peDst, pbScratch, cbScratch );
757
1.17k
}
758
759
SYMCRYPT_DISABLE_CFG
760
VOID
761
SYMCRYPT_CALL
762
SymCryptModElementToInt(
763
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
764
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc,
765
    _Out_                           PSYMCRYPT_INT           piDst,
766
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
767
                                    SIZE_T                  cbScratch )
768
382
{
769
382
    PCUINT32 pData;
770
771
382
    SYMCRYPT_ASSERT( piDst->nDigits >= pmMod->nDigits );
772
773
382
    pData = SYMCRYPT_MOD_CALL( pmMod ) modPreGet( pmMod, peSrc, pbScratch, cbScratch );
774
775
382
    SymCryptFdefModElementToIntGeneric( pmMod, pData, piDst, pbScratch, cbScratch );
776
382
}
777
778
SYMCRYPT_DISABLE_CFG
779
SYMCRYPT_ERROR
780
SYMCRYPT_CALL
781
SymCryptModElementSetValue(
782
    _In_reads_bytes_( cbSrc )       PCBYTE                  pbSrc,
783
                                    SIZE_T                  cbSrc,
784
                                    SYMCRYPT_NUMBER_FORMAT  format,
785
                                    PCSYMCRYPT_MODULUS      pmMod,
786
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
787
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
788
                                    SIZE_T                  cbScratch )
789
4.36k
{
790
4.36k
    SYMCRYPT_ERROR  scError;
791
792
4.36k
    scError = SymCryptFdefModElementSetValueGeneric( pbSrc, cbSrc, format, pmMod, peDst, pbScratch, cbScratch );
793
794
4.36k
    if( scError == SYMCRYPT_NO_ERROR )
795
4.36k
    {
796
4.36k
        SYMCRYPT_MOD_CALL( pmMod ) modSetPost( pmMod, peDst, pbScratch, cbScratch );
797
4.36k
    }
798
799
4.36k
    return scError;
800
4.36k
}
801
802
SYMCRYPT_ERROR
803
SYMCRYPT_CALL
804
SymCryptModElementGetValue(
805
                                    PCSYMCRYPT_MODULUS      pmMod,
806
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc,
807
    _Out_writes_bytes_( cbDst )     PBYTE                   pbDst,
808
                                    SIZE_T                  cbDst,
809
                                    SYMCRYPT_NUMBER_FORMAT  format,
810
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
811
                                    SIZE_T                  cbScratch )
812
1.76k
{
813
1.76k
    return SymCryptFdefModElementGetValue( pmMod, peSrc, pbDst, cbDst, format, pbScratch, cbScratch );
814
1.76k
}
815
816
UINT32
817
SYMCRYPT_CALL
818
SymCryptModElementIsEqual(
819
    _In_    PCSYMCRYPT_MODULUS     pmMod,
820
    _In_    PCSYMCRYPT_MODELEMENT  peSrc1,
821
    _In_    PCSYMCRYPT_MODELEMENT  peSrc2 )
822
4.34k
{
823
4.34k
    return SymCryptFdefModElementIsEqual( pmMod, peSrc1, peSrc2 );
824
4.34k
}
825
826
UINT32
827
SYMCRYPT_CALL
828
SymCryptModElementIsZero(
829
    _In_    PCSYMCRYPT_MODULUS     pmMod,
830
    _In_    PCSYMCRYPT_MODELEMENT  peSrc )
831
77.3k
{
832
77.3k
    return SymCryptFdefModElementIsZero( pmMod, peSrc );
833
77.3k
}
834
835
SYMCRYPT_DISABLE_CFG
836
VOID
837
SYMCRYPT_CALL
838
SymCryptModAdd(
839
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
840
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc1,
841
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc2,
842
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
843
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
844
                                    SIZE_T                  cbScratch )
845
2.39M
{
846
2.39M
    SYMCRYPT_MOD_CALL( pmMod ) modAdd( pmMod, peSrc1, peSrc2, peDst, pbScratch, cbScratch );
847
2.39M
}
848
849
SYMCRYPT_DISABLE_CFG
850
VOID
851
SYMCRYPT_CALL
852
SymCryptModSub(
853
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
854
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc1,
855
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc2,
856
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
857
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
858
                                    SIZE_T                  cbScratch )
859
2.52M
{
860
2.52M
    SYMCRYPT_MOD_CALL( pmMod ) modSub( pmMod, peSrc1, peSrc2, peDst, pbScratch, cbScratch );
861
2.52M
}
862
863
864
SYMCRYPT_DISABLE_CFG
865
VOID
866
SYMCRYPT_CALL
867
SymCryptModMul(
868
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
869
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc1,
870
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc2,
871
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
872
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
873
                                    SIZE_T                  cbScratch )
874
3.36M
{
875
3.36M
    SYMCRYPT_MOD_CALL( pmMod ) modMul( pmMod, peSrc1, peSrc2, peDst, pbScratch, cbScratch );
876
3.36M
}
877
878
SYMCRYPT_DISABLE_CFG
879
VOID
880
SYMCRYPT_CALL
881
SymCryptModSquare(
882
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
883
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc,
884
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
885
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
886
                                    SIZE_T                  cbScratch )
887
1.23M
{
888
1.23M
    SYMCRYPT_MOD_CALL( pmMod ) modSquare( pmMod, peSrc, peDst, pbScratch, cbScratch );
889
1.23M
}
890
891
892
SYMCRYPT_DISABLE_CFG
893
VOID
894
SYMCRYPT_CALL
895
SymCryptModNeg(
896
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
897
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc,
898
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
899
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
900
                                    SIZE_T                  cbScratch )
901
83.3k
{
902
83.3k
    SYMCRYPT_MOD_CALL( pmMod ) modNeg( pmMod, peSrc, peDst, pbScratch, cbScratch );
903
83.3k
}
904
905
SYMCRYPT_DISABLE_CFG
906
VOID
907
SYMCRYPT_CALL
908
SymCryptModElementSetValueUint32(
909
                                    UINT32                  value,
910
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
911
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
912
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
913
                                    SIZE_T                  cbScratch )
914
4.28k
{
915
4.28k
    SymCryptFdefModElementSetValueUint32Generic( value, pmMod, peDst, pbScratch, cbScratch );
916
917
4.28k
    SYMCRYPT_MOD_CALL( pmMod ) modSetPost( pmMod, peDst, pbScratch, cbScratch );
918
4.28k
}
919
920
VOID
921
SYMCRYPT_CALL
922
SymCryptModElementSetValueNegUint32(
923
                                    UINT32                  value,
924
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
925
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
926
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
927
                                    SIZE_T                  cbScratch )
928
852
{
929
852
    SymCryptFdefModElementSetValueNegUint32( value, pmMod, peDst, pbScratch, cbScratch );
930
852
}
931
932
VOID
933
SYMCRYPT_CALL
934
SymCryptModDivPow2(
935
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
936
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc,
937
                                    UINT32                  exp,
938
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
939
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
940
                                    SIZE_T                  cbScratch )
941
0
{
942
0
    SymCryptFdefModDivPow2( pmMod, peSrc, exp, peDst, pbScratch, cbScratch );
943
0
}
944
945
SYMCRYPT_DISABLE_CFG
946
SYMCRYPT_ERROR
947
SYMCRYPT_CALL
948
SymCryptModInv(
949
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
950
    _In_                            PCSYMCRYPT_MODELEMENT   peSrc,
951
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
952
                                    UINT32                  flags,
953
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
954
                                    SIZE_T                  cbScratch )
955
1.23k
{
956
1.23k
    return SYMCRYPT_MOD_CALL( pmMod ) modInv( pmMod, peSrc, peDst, flags, pbScratch, cbScratch );
957
1.23k
}
958
959
VOID
960
SYMCRYPT_CALL
961
SymCryptModExp(
962
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
963
    _In_                            PCSYMCRYPT_MODELEMENT   peBase,
964
    _In_                            PCSYMCRYPT_INT          piExp,
965
                                    UINT32                  nBitsExp,
966
                                    UINT32                  flags,
967
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
968
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
969
                                    SIZE_T                  cbScratch )
970
0
{
971
0
    SymCryptModExpGeneric( pmMod, peBase, piExp, nBitsExp, flags, peDst, pbScratch, cbScratch );
972
0
}
973
974
SYMCRYPT_ERROR
975
SYMCRYPT_CALL
976
SymCryptModMultiExp(
977
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
978
    _In_reads_( nBases )            PCSYMCRYPT_MODELEMENT * peBaseArray,
979
    _In_reads_( nBases )            PCSYMCRYPT_INT *        piExpArray,
980
                                    UINT32                  nBases,
981
                                    UINT32                  nBitsExp,
982
                                    UINT32                  flags,
983
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
984
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
985
                                    SIZE_T                  cbScratch )
986
0
{
987
0
    return SymCryptModMultiExpGeneric( pmMod, peBaseArray, piExpArray, nBases, nBitsExp, flags, peDst, pbScratch, cbScratch );
988
0
}
989
990
SYMCRYPT_DISABLE_CFG
991
VOID
992
SYMCRYPT_CALL
993
SymCryptModSetRandom(
994
    _In_                            PCSYMCRYPT_MODULUS      pmMod,
995
    _Out_                           PSYMCRYPT_MODELEMENT    peDst,
996
                                    UINT32                  flags,
997
    _Out_writes_bytes_( cbScratch ) PBYTE                   pbScratch,
998
                                    SIZE_T                  cbScratch )
999
268
{
1000
268
    SymCryptFdefModSetRandomGeneric( pmMod, peDst, flags, pbScratch, cbScratch );
1001
1002
268
    SYMCRYPT_MOD_CALL( pmMod ) modSetPost( pmMod, peDst, pbScratch, cbScratch );
1003
268
}
1004
1005
PCSYMCRYPT_TRIALDIVISION_CONTEXT
1006
SYMCRYPT_CALL
1007
SymCryptCreateTrialDivisionContext( UINT32 nDigits )
1008
0
{
1009
0
    return SymCryptFdefCreateTrialDivisionContext( nDigits );
1010
0
}
1011
1012
UINT32
1013
SYMCRYPT_CALL
1014
SymCryptIntFindSmallDivisor(
1015
    _In_                            PCSYMCRYPT_TRIALDIVISION_CONTEXT    pContext,
1016
    _In_                            PCSYMCRYPT_INT                      piSrc,
1017
    _Out_writes_bytes_( cbScratch ) PBYTE                               pbScratch,
1018
                                    SIZE_T                              cbScratch )
1019
0
{
1020
0
    return SymCryptFdefIntFindSmallDivisor( pContext, piSrc, pbScratch, cbScratch );
1021
0
}
1022
1023
VOID
1024
SYMCRYPT_CALL
1025
SymCryptFreeTrialDivisionContext( PCSYMCRYPT_TRIALDIVISION_CONTEXT pContext )
1026
0
{
1027
0
    SymCryptFdefFreeTrialDivisionContext( pContext );
1028
0
}