1/*
2 * Copyright (c) 2011 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _CC_BIGNUM_H_
25#define _CC_BIGNUM_H_
26
27#include <Availability.h>
28#include <stdint.h>
29#include <CommonCrypto/CommonCryptor.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/*
36 * This is an SPI - it isn't intended to be generally used.  If you
37 * intend to use this we strongly urge you to talk to someone in the
38 * Information Security Group to see if there isn't an alternative
39 * set of functions to implement your cryptographic needs.
40 */
41
42/*
43 * This shares the error status of CommonCryptor.h
44 */
45
46typedef CCCryptorStatus CCStatus;
47typedef struct _CCBigNumRef *CCBigNumRef;
48
49/*!
50	@function   CCCreateBigNum
51	@abstract   Creates a BigNum - must be freed later with
52             	CCBigNumFree.
53
54	@param      status  A pointer to a CCStatus for return codes.
55
56	@result		On success this returns a newly
57    			allocated BigNum (must be freed with
58                CCBigNumFree).
59                Returns NULL on failure.
60 */
61
62CCBigNumRef
63CCCreateBigNum(CCStatus *status)
64__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
65
66
67
68/*!
69	@function   CCBigNumClear
70	@abstract   Zeroes (clears) a BigNum.
71
72	@param      bn The BigNum to clear.
73	@result		returns a CCStatus (See CommonCryptor.h for values).
74 */
75
76CCStatus
77CCBigNumClear(CCBigNumRef bn)
78__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
79
80
81/*!
82	@function   CCBigNumFree
83	@abstract   Frees and clears a BigNum.
84
85	@param      bn The BigNum to free.
86
87 */
88
89void
90CCBigNumFree(CCBigNumRef bn)
91__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
92
93
94/*!
95	@function   CCBigNumCopy
96	@abstract   Copies a BigNum.
97
98	@param      status  A pointer to a CCStatus for return codes.
99	@param      bn The BigNum to copy.
100	@result		On success this returns a newly
101    			allocated BigNum (must be freed with
102                CCBigNumFree).
103                Returns NULL on failure.
104 */
105
106CCBigNumRef
107CCBigNumCopy(CCStatus *status, const CCBigNumRef bn)
108__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
109
110
111/*!
112	@function   CCBigNumBitCount
113	@abstract   Returns the number of significant bits
114    			in a BigNum.
115
116	@param      bn The BigNum.
117	@result		Returns number of bits.
118
119 */
120
121uint32_t
122CCBigNumBitCount(const CCBigNumRef bn)
123__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
124
125
126/*!
127	@function   CCBigNumZeroLSBCount
128	@abstract   Returns the number of zero bits
129    			before the least significant 1 bit.
130
131	@param      bn The BigNum.
132	@result		Returns number of bits.
133
134 */
135
136uint32_t
137CCBigNumZeroLSBCount(const CCBigNumRef bn)
138__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
139
140
141/*!
142	@function   CCBigNumByteCount
143	@abstract   Returns the number of bytes if
144    			converted to binary data.
145
146	@param      bn The BigNum.
147	@result		Returns number of bytes.
148
149 */
150
151uint32_t
152CCBigNumByteCount(const CCBigNumRef bn)
153__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
154
155
156/*!
157	@function   CCBigNumFromData
158	@abstract   Creates a BigNum from binary data.
159
160	@param      status  A pointer to a CCStatus for return codes.
161	@param      s - the data pointer.  The data is expected to be
162    			an array of octets in big endian format.
163	@param      len - the length of the data.
164	@result		On success this returns a newly
165    			allocated BigNum (must be freed with
166                CCBigNumFree).
167                Returns NULL on failure.
168 */
169
170CCBigNumRef
171CCBigNumFromData(CCStatus *status, const void *s, size_t len)
172__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
173
174
175/*!
176	@function   CCBigNumToData
177	@abstract   Dumps a BigNum into binary data.
178
179	@param      status  A pointer to a CCStatus for return codes.
180	@param      bn The BigNum.
181	@param      s - the pointer to the data area.
182    			You can use CCBigNumByteCount() to
183                determine the size of the data area
184                to provide.
185	@result     Returns the length of the data area.
186
187 */
188
189size_t
190CCBigNumToData(CCStatus *status, const CCBigNumRef bn, void *to)
191__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
192
193
194/*!
195	@function   CCBigNumFromHexString
196	@abstract   Creates a BigNum from a hexadecimal string.
197
198	@param      status  A pointer to a CCStatus for return codes.
199	@param      in - a null terminated hexadecimal string.
200	@result		On success this returns a newly
201    			allocated BigNum (must be freed with
202                CCBigNumFree).
203                Returns NULL on failure.
204 */
205
206CCBigNumRef
207CCBigNumFromHexString(CCStatus *status, const char *in)
208__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
209
210
211/*!
212	@function   CCBigNumToHexString
213	@abstract   Dumps a BigNum into hexadecimal string.
214
215	@param      status  A pointer to a CCStatus for return codes.
216	@param      bn The BigNum.
217	@result     Returns a hexadecimal string representation
218    			of the BigNum.  This must be freed by the caller.
219                Returns NULL on failure.
220
221 */
222
223char *
224CCBigNumToHexString(CCStatus *status, const CCBigNumRef bn)
225__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
226
227/*!
228 @function   CCBigNumFromDecimalString
229 @abstract   Creates a BigNum from a decimal string.
230
231 @param      status  A pointer to a CCStatus for return codes.
232 @param      in - a null terminated decimal string.
233 @result		On success this returns a newly
234 allocated BigNum (must be freed with
235 CCBigNumFree).
236 Returns NULL on failure.
237 */
238
239CCBigNumRef
240CCBigNumFromDecimalString(CCStatus *status, const char *in)
241__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_6_0);
242
243
244/*!
245 @function   CCBigNumToDecimalString
246 @abstract   Dumps a BigNum into a decimal string.
247
248 @param      status  A pointer to a CCStatus for return codes.
249 @param      bn The BigNum.
250 @result     Returns a decimal string representation
251 of the BigNum.  This must be freed by the caller.
252 Returns NULL on failure.
253
254 */
255
256char *
257CCBigNumToDecimalString(CCStatus *status, const CCBigNumRef bn)
258__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_6_0);
259
260
261/*!
262	@function   CCBigNumByteCount
263	@abstract   Returns the number of bytes that will result from
264    			converting a BigNum to octets.
265
266	@param      bn The BigNum.
267	@result		The number of bytes.
268 */
269
270uint32_t
271CCBigNumByteCount(const CCBigNumRef bn)
272__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
273
274
275/*!
276	@function   CCBigNumCompare
277	@abstract   Compares two BigNums.
278
279	@param      bn1 - a BigNum.
280	@param      bn2 - a BigNum.
281	@result		Returns -1 if bn1 is less than bn2.
282                Returns 0 if bn1 and bn2 are equal.
283                Returns 1 if bn1 is greater than bn2.
284
285 */
286
287int
288CCBigNumCompare(const CCBigNumRef bn1, const CCBigNumRef bn2)
289__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
290
291
292/*!
293	@function   CCBigNumCompareI
294	@abstract   Compares a BigNum and a 32 bit integer.
295
296	@param      bn1 - a BigNum.
297	@param      num - an integer.
298	@result		Returns -1 if bn1 is less than num.
299                Returns 0 if bn1 and num are equal.
300                Returns 1 if bn1 is greater than num.
301
302 */
303
304
305int
306CCBigNumCompareI(const CCBigNumRef bn1, const uint32_t num)
307__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
308
309
310/*!
311	@function   CCBigNumSetNegative
312	@abstract   Negates a BigNum.
313
314	@param      bn - a BigNum.
315	@result		returns a CCStatus (See CommonCryptor.h for values).
316
317 */
318
319CCStatus
320CCBigNumSetNegative(CCBigNumRef bn)
321__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
322
323
324
325/*!
326	@function   CCBigNumSetI
327	@abstract   Sets a BigNum value using an unsigned integer.
328
329	@param      bn The BigNum.
330	@param      num The value to set.
331	@result		returns a CCStatus (See CommonCryptor.h for values).
332 */
333
334CCStatus
335CCBigNumSetI(CCBigNumRef bn, uint64_t num)
336__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
337
338
339
340/*!
341	@function   CCBigNumGetI
342	@abstract   Get an unsigned integer representation of the BigNum.
343                This assumes the BigNum can actually fit within the
344                unsigned integer representation.
345
346	@param      status  A pointer to a CCStatus for return codes.
347	@param      bn The BigNum.
348	@result		returns the unsigned integer value.
349 */
350
351uint32_t
352CCBigNumGetI(CCStatus *status, const CCBigNumRef bn)
353__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
354
355
356
357/*!
358	@function   CCBigNumAdd
359	@abstract   Adds two BigNums.
360
361	@param		result  A bigNum in which to place the result.
362    @param		a		The first BigNum to add.
363    @param		b		The second BigNum to add.
364
365	@result		returns a CCStatus (See CommonCryptor.h for values).
366 */
367
368CCStatus
369CCBigNumAdd(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b)
370__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
371
372
373
374/*!
375	@function   CCBigNumAddI
376	@abstract   Adds a BigNum and an unsigned integer.
377
378	@param		result  A bigNum in which to place the result.
379    @param		a		The first BigNum to add.
380    @param		b		The unsigned integer to add.
381
382	@result		returns a CCStatus (See CommonCryptor.h for values).
383 */
384
385CCStatus
386CCBigNumAddI(CCBigNumRef result, const CCBigNumRef a, const uint32_t b)
387__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
388
389
390
391/*!
392	@function   CCBigNumSub
393	@abstract   Subtracts a BigNum from a BigNum.
394
395	@param		result  A bigNum in which to place the result.
396    @param		a		The BigNum.
397    @param		b		The BigNum to subtract.
398
399	@result		returns a CCStatus (See CommonCryptor.h for values).
400 */
401
402CCStatus
403CCBigNumSub(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b)
404__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
405
406
407
408/*!
409	@function   CCBigNumSubI
410	@abstract   Subtracts an unsigned integer from a BigNum.
411
412	@param		result  A bigNum in which to place the result.
413    @param		a		The BigNum.
414    @param		b		The unsigned integer to subtract.
415
416	@result		returns a CCStatus (See CommonCryptor.h for values).
417 */
418
419CCStatus
420CCBigNumSubI(CCBigNumRef result, const CCBigNumRef a, const uint32_t b)
421__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
422
423
424
425/*!
426	@function   CCBigNumMul
427	@abstract   Multiplies two BigNums.
428
429	@param		result  A bigNum in which to place the result.
430    @param		a		The first BigNum to multiply.
431    @param		b		The second BigNum to multiply.
432
433    @result		returns a CCStatus (See CommonCryptor.h for values).
434 */
435
436CCStatus
437CCBigNumMul(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b)
438__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
439
440
441
442/*!
443	@function   CCBigNumMulI
444	@abstract   Multiplies a BigNum and an unsigned integer.
445
446	@param		result  A bigNum in which to place the result.
447    @param		a		The first BigNum to multiply.
448    @param		b		The unsigned integer to multiply.
449
450	@result		returns a CCStatus (See CommonCryptor.h for values).
451 */
452
453CCStatus
454CCBigNumMulI(CCBigNumRef result, const CCBigNumRef a, const uint32_t b)
455__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
456
457
458
459/*!
460	@function   CCBigNumDiv
461	@abstract   Divides a BigNum (a) by another Bignum (b).
462
463	@param		quotient  A bigNum in which to place the quotient (a div b).
464	@param		remainder  A bigNum in which to place the remainder (a mod b).
465    @param		a		The BigNum to divide.
466    @param		b		The BigNum used to divide a.
467
468	@result		returns a CCStatus (See CommonCryptor.h for values).
469 */
470
471CCStatus
472CCBigNumDiv(CCBigNumRef quotient, CCBigNumRef remainder, const CCBigNumRef a, const CCBigNumRef b)
473__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
474
475
476
477/*!
478	@function   CCBigNumDiv2
479	@abstract   Divides a BigNum (a) by 2.
480
481	@param		result  A bigNum in which to place the result.
482    @param		a		The BigNum to divide.
483
484	@result		returns a CCStatus (See CommonCryptor.h for values).
485 */
486
487CCStatus
488CCBigNumDiv2(CCBigNumRef result, const CCBigNumRef a)
489__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
490
491
492
493/*!
494	@function   CCBigNumMod
495	@abstract   Find the remainder of a BigNum for a given modulus.
496
497	@param		result  A bigNum in which to place the result.
498    @param		dividend	The BigNum to divide.
499    @param		modulus		The BigNum used to divide a and produce the mod value.
500
501	@result		returns a CCStatus (See CommonCryptor.h for values).
502 */
503
504CCStatus
505CCBigNumMod(CCBigNumRef result, CCBigNumRef dividend, CCBigNumRef modulus)
506__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
507
508
509
510/*!
511	@function   CCBigNumModI
512	@abstract   Find the remainder of a BigNum for a given modulus (unsigned integer version).
513
514	@param		result      A pointer to an unsigned integer in which to place the result.
515    @param		dividend	The BigNum to divide.
516    @param		modulus		The BigNum used to divide a and produce the mod value.
517
518	@result		returns a CCStatus (See CommonCryptor.h for values).
519 */
520
521CCStatus
522CCBigNumModI(uint32_t *result, CCBigNumRef dividend, uint32_t modulus)
523__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
524
525
526
527/*!
528	@function   CCBigNumSquare
529	@abstract   Find the square of a BigNum.
530
531	@param		result  A bigNum in which to place the result.
532    @param		a	The BigNum to square.
533
534	@result		returns a CCStatus (See CommonCryptor.h for values).
535 */
536
537CCStatus
538CCBigNumSquare(CCBigNumRef result, const CCBigNumRef a)
539__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
540
541
542
543/*!
544	@function   CCBigNumGCD
545	@abstract   Find the Greatest Common Denominator of two BigNums.
546
547	@param		result  A bigNum in which to place the result.
548    @param		a	A BigNum.
549    @param		b	A BigNum.
550
551	@result		returns a CCStatus (See CommonCryptor.h for values).
552 */
553
554CCStatus
555CCBigNumGCD(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b)
556__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
557
558
559
560/*!
561	@function   CCBigNumLCM
562	@abstract   Find the Least Common Multiple of two BigNums.
563
564	@param		result  A bigNum in which to place the result.
565    @param		a	A BigNum.
566    @param		b	A BigNum.
567
568	@result		returns a CCStatus (See CommonCryptor.h for values).
569 */
570
571CCStatus
572CCBigNumLCM(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b)
573__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
574
575
576
577/*!
578	@function   CCBigNumMulMod
579	@abstract   Perform Modular Multiplication.
580
581	@param		result  A bigNum in which to place the result.
582    @param		a	A BigNum.
583    @param		b	A BigNum.
584    @param		modulus	The Modulus.
585
586	@result		returns a CCStatus (See CommonCryptor.h for values).
587 */
588
589CCStatus
590CCBigNumMulMod(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef b, const CCBigNumRef modulus)
591__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
592
593
594
595/*!
596	@function   CCBigNumSquareMod
597	@abstract   Perform Modular Squaring.
598
599	@param		result  A bigNum in which to place the result.
600    @param		a	A BigNum.
601    @param		modulus	The Modulus.
602
603	@result		returns a CCStatus (See CommonCryptor.h for values).
604 */
605
606CCStatus
607CCBigNumSquareMod(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef modulus)
608__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
609
610
611
612/*!
613	@function   CCBigNumInverseMod
614	@abstract   Perform Modular Inversion.
615
616	@param		result  A bigNum in which to place the result.
617    @param		a		A BigNum.
618    @param		modulus	The Modulus.
619
620	@result		returns a CCStatus (See CommonCryptor.h for values).
621 */
622
623CCStatus
624CCBigNumInverseMod(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef modulus)
625__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
626
627
628
629/*!
630	@function   CCBigNumModExp
631	@abstract   Perform Modular Exponentiation.
632
633	@param		result  A bigNum in which to place the result.
634    @param		a		The base integer.
635    @param		power	The power integer.
636    @param		modulus	The Modulus.
637
638	@result		returns a CCStatus (See CommonCryptor.h for values).
639 */
640
641CCStatus
642CCBigNumModExp(CCBigNumRef result, const CCBigNumRef a, const CCBigNumRef power, const CCBigNumRef modulus)
643__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
644
645
646
647/*!
648	@function   CCBigNumLeftShift
649	@abstract   Shift a BigNum left
650
651	@param		result  A bigNum in which to place the result.
652	@param      a		The BigNum.
653	@param      digits	How many bit places to shift left.
654
655	@result		returns a CCStatus (See CommonCryptor.h for values).
656 */
657
658CCStatus
659CCBigNumLeftShift(CCBigNumRef result, const CCBigNumRef a, const uint32_t digits)
660__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
661
662
663
664/*!
665	@function   CCBigNumRightShift
666	@abstract   Shift a BigNum right
667
668	@param		result  A bigNum in which to place the result.
669	@param      a		The BigNum.
670	@param      digits	How many bit places to shift right.
671
672	@result		returns a CCStatus (See CommonCryptor.h for values).
673 */
674
675CCStatus
676CCBigNumRightShift(CCBigNumRef result, const CCBigNumRef a, const uint32_t digits)
677__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
678
679
680
681/*!
682	@function   CCBigNumMontgomerySetup
683	@abstract   Setup Montgomery
684
685	@param      num	The modulus.
686	@param      rho	The destination for the reduction digit.
687
688	@result		returns a CCStatus (See CommonCryptor.h for values).
689 */
690
691CCStatus
692CCBigNumMontgomerySetup(CCBigNumRef num, uint32_t *rho)
693__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
694
695
696
697/*!
698	@function   CCBigNumMontgomeryNormalization
699	@abstract   Get the normalization value.
700
701	@param		result  A bigNum in which to place the result.
702	@param      modulus	The modulus.
703
704	@result		returns a CCStatus (See CommonCryptor.h for values).
705 */
706
707CCStatus
708CCBigNumMontgomeryNormalization(CCBigNumRef result, CCBigNumRef modulus)
709__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
710
711
712
713/*!
714	@function   CCBigNumMontgomeryReduce
715	@abstract   Reduce a number
716
717	@param      x 	The BigNum to reduce - the result will be stored back into
718    				this BigNum.
719	@param      modulus	The modulus.
720	@param      rho		The reduction digit.
721
722	@result		returns a CCStatus (See CommonCryptor.h for values).
723 */
724
725CCStatus
726CCBigNumMontgomeryReduce(CCBigNumRef x, CCBigNumRef modulus, uint32_t rho)
727__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
728
729
730
731/*!
732	@function   CCBigNumCreateRandom
733	@abstract   Creates a BigNum with a random value.
734    ZZZZZ
735
736	@param      status  A pointer to a CCStatus for return codes.
737	@result		On success this returns a newly
738    			allocated BigNum (must be freed with
739                CCBigNumFree).
740                Returns NULL on failure.
741 */
742
743CCBigNumRef
744CCBigNumCreateRandom(CCStatus *status, int bits, int top, int bottom)
745__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
746
747/*!
748	@function   CCBigNumIsPrime
749	@abstract   Determines if a BigNum is prime.
750
751	@param      status  A pointer to a CCStatus for return codes.
752	@param      bn - a BigNum.
753	@result		Returns true or false.
754 */
755
756bool
757CCBigNumIsPrime(CCStatus *status, const CCBigNumRef bn)
758__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
759
760/*!
761	@function   CCBigNumIsOdd
762	@abstract   Determines if a BigNum is odd.
763
764	@param      status  A pointer to a CCStatus for return codes.
765	@param      bn - a BigNum.
766	@result		Returns true or false.
767 */
768
769bool
770CCBigNumIsOdd(CCStatus *status, const CCBigNumRef bn)
771__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
772
773/*!
774	@function   CCBigNumIsZero
775	@abstract   Determines if a BigNum is zero.
776
777	@param      status  A pointer to a CCStatus for return codes.
778	@param      bn - a BigNum.
779	@result		Returns true or false.
780 */
781
782bool
783CCBigNumIsZero(CCStatus *status, const CCBigNumRef bn)
784__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
785
786/*!
787	@function   CCBigNumIsNegative
788	@abstract   Determines if a BigNum is negative.
789
790	@param      status  A pointer to a CCStatus for return codes.
791	@param      bn - a BigNum.
792	@result		Returns true or false.
793 */
794
795bool
796CCBigNumIsNegative(CCStatus *status, const CCBigNumRef bn)
797__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
798
799#ifdef __cplusplus
800}
801#endif
802
803#endif  /* _CC_BIGNUM_H_ */
804