Andrew Boyson / lpc1768

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

Committer:
andrewboyson
Date:
Wed Jun 19 12:33:14 2019 +0000
Revision:
53:3888bf121010
Parent:
52:88d594aca377
Child:
54:9b3b189bc82c
Refined the modulus to make it faster

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 53:3888bf121010 23 extern void BnDiv (uint32_t* a, uint32_t* b, uint32_t* r);
andrewboyson 53:3888bf121010 24 extern void BnMod (uint32_t* a, uint32_t* b, uint32_t* r);
andrewboyson 53:3888bf121010 25 extern void BnDivMod(uint32_t* a, uint32_t* b, uint32_t* r, uint32_t* m);
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 53:3888bf121010 33 extern int BnModExpStatus;
andrewboyson 53:3888bf121010 34 extern int BnModExpProgress;
andrewboyson 53:3888bf121010 35 extern uint64_t BnModExpMulHr;
andrewboyson 53:3888bf121010 36 extern uint64_t BnModExpModHr;
andrewboyson 53:3888bf121010 37 extern void BnModExpStart(uint32_t* message, uint32_t* exponent, uint32_t* modulus, uint32_t* result);
andrewboyson 52:88d594aca377 38
andrewboyson 52:88d594aca377 39