Uso de esta libreria para funciones criptograficas con curvas elipticas.
Dependencies: mbed tinydtls lwip-mbed-2010
main.cpp@1:b7f306783a3c, 2015-02-08 (annotated)
- Committer:
- saranieves92
- Date:
- Sun Feb 08 19:48:50 2015 +0000
- Revision:
- 1:b7f306783a3c
- Parent:
- 0:7197fcdec294
Resueltos problemas de dependencias, pero aparecen otros con ethernet.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
saranieves92 | 0:7197fcdec294 | 1 | #include "mbed.h" |
saranieves92 | 0:7197fcdec294 | 2 | Serial pc(USBTX, USBRX); // tx, rx |
saranieves92 | 0:7197fcdec294 | 3 | DigitalOut myled(LED1); |
saranieves92 | 0:7197fcdec294 | 4 | |
saranieves92 | 0:7197fcdec294 | 5 | int main() { |
saranieves92 | 0:7197fcdec294 | 6 | |
saranieves92 | 0:7197fcdec294 | 7 | |
saranieves92 | 0:7197fcdec294 | 8 | //ecc_gen_pub_key(const uint32_t *priv_key, uint32_t *pub_x, uint32_t *pub_y) |
saranieves92 | 0:7197fcdec294 | 9 | /* |
saranieves92 | 0:7197fcdec294 | 10 | * d: private key on the curve secp256r1 (32 bytes) |
saranieves92 | 0:7197fcdec294 | 11 | * e: hash to sign (32 bytes) |
saranieves92 | 0:7197fcdec294 | 12 | * k: random data, this must be changed for every signature (32 bytes) |
saranieves92 | 0:7197fcdec294 | 13 | * |
saranieves92 | 0:7197fcdec294 | 14 | * output: |
saranieves92 | 0:7197fcdec294 | 15 | * r: r value of the signature (36 bytes) |
saranieves92 | 0:7197fcdec294 | 16 | * s: s value of the signature (36 bytes) |
saranieves92 | 0:7197fcdec294 | 17 | * |
saranieves92 | 0:7197fcdec294 | 18 | * return: |
saranieves92 | 0:7197fcdec294 | 19 | * 0: everything is ok |
saranieves92 | 0:7197fcdec294 | 20 | * -1: can not create signature, try again with different k. |
saranieves92 | 0:7197fcdec294 | 21 | */ |
saranieves92 | 0:7197fcdec294 | 22 | /*uint32_t kPrivada=1147483647; |
saranieves92 | 0:7197fcdec294 | 23 | uint32_t hash=2147483117; |
saranieves92 | 0:7197fcdec294 | 24 | uint32_t ran=1147483147; |
saranieves92 | 0:7197fcdec294 | 25 | uint32_t firma_r; |
saranieves92 | 0:7197fcdec294 | 26 | uint32_t firma_s; |
saranieves92 | 0:7197fcdec294 | 27 | if (ecc_ecdsa_sign(&kPrivada, &hash, &ran, &firma_r, &firma_s)==0) pc.printf("Hola Mundo\n"); |
saranieves92 | 0:7197fcdec294 | 28 | else pc.printf("Adios Mundo Cruel\n"); |
saranieves92 | 0:7197fcdec294 | 29 | |
saranieves92 | 0:7197fcdec294 | 30 | */ |
saranieves92 | 0:7197fcdec294 | 31 | } |