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