Andrew Boyson / lpc1768

Dependents:   test-lpc1768 oldheating gps motorhome ... more

Committer:
andrewboyson
Date:
Wed Jun 19 15:34:17 2019 +0000
Revision:
54:9b3b189bc82c
Parent:
53:3888bf121010
Child:
55:975f706c67d2
Minor improvements to bignum

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 52:88d594aca377 1 #include <stdint.h>
andrewboyson 52:88d594aca377 2 #include <stdbool.h>
andrewboyson 52:88d594aca377 3
andrewboyson 52:88d594aca377 4 //Assembly instructions
andrewboyson 53:3888bf121010 5 extern void BnZer2048(uint32_t* acc);
andrewboyson 53:3888bf121010 6 extern void BnInc2048(uint32_t* acc);
andrewboyson 53:3888bf121010 7 extern void BnShiftR2048(uint32_t* acc);
andrewboyson 53:3888bf121010 8 extern void BnShiftL2048(uint32_t* acc);
andrewboyson 53:3888bf121010 9 extern void BnCpy2048(uint32_t* acc, uint32_t* value);
andrewboyson 53:3888bf121010 10 extern void BnOrr2048(uint32_t* acc, uint32_t* value);
andrewboyson 53:3888bf121010 11 extern void BnAdd2048(uint32_t* acc, uint32_t* value);
andrewboyson 53:3888bf121010 12 extern void BnSub2048(uint32_t* acc, uint32_t* value);
andrewboyson 53:3888bf121010 13 extern bool BnIsEmpty2048 (uint32_t* value);
andrewboyson 53:3888bf121010 14 extern bool BnIsNotEmpty2048 (uint32_t* value);
andrewboyson 53:3888bf121010 15 extern int BnCmp2048(uint32_t* lhs, uint32_t* rhs);
andrewboyson 52:88d594aca377 16
andrewboyson 53:3888bf121010 17 // Text functions
andrewboyson 53:3888bf121010 18 extern void BnParseHex(uint32_t* n, const char* p);
andrewboyson 53:3888bf121010 19 extern void BnAsHttp (uint32_t* n);
andrewboyson 52:88d594aca377 20
andrewboyson 52:88d594aca377 21 // Arithmetic operations
andrewboyson 53:3888bf121010 22 extern void Bn1024Mul2048 (uint32_t* a1024, uint32_t* b1024, uint32_t* r2048);
andrewboyson 54:9b3b189bc82c 23 extern void BnDiv (uint32_t* n, uint32_t* d, uint32_t* q );
andrewboyson 54:9b3b189bc82c 24 extern void BnRem (uint32_t* n, uint32_t* d, uint32_t* r);
andrewboyson 54:9b3b189bc82c 25 extern void BnDivRem(uint32_t* n, uint32_t* d, uint32_t* q, uint32_t* r);
andrewboyson 52:88d594aca377 26
andrewboyson 52:88d594aca377 27 // Asynchronous operations
andrewboyson 52:88d594aca377 28 #define BIGNUM_CALC_NONE 0
andrewboyson 52:88d594aca377 29 #define BIGNUM_CALC_STARTED 1
andrewboyson 52:88d594aca377 30 #define BIGNUM_CALC_FINISHED 2
andrewboyson 52:88d594aca377 31 extern void BnAsyncMain(void);
andrewboyson 52:88d594aca377 32
andrewboyson 54:9b3b189bc82c 33 extern int BnExpModStatus;
andrewboyson 54:9b3b189bc82c 34 extern int BnExpModProgress;
andrewboyson 54:9b3b189bc82c 35 extern uint64_t BnMulHr;
andrewboyson 54:9b3b189bc82c 36 extern uint64_t BnModHr;
andrewboyson 54:9b3b189bc82c 37 extern void BnExpModStart(uint32_t* message, uint32_t* exponent, uint32_t* modulus, uint32_t* result);
andrewboyson 52:88d594aca377 38
andrewboyson 52:88d594aca377 39