cyassl re-port with cellular comms, PSK test
Dependencies: VodafoneUSBModem_bleedingedge2 mbed-rtos mbed-src
cyassllib/cyassl/ctaocrypt/dsa.h@1:b211d97b0068, 2013-04-26 (annotated)
- Committer:
- ashleymills
- Date:
- Fri Apr 26 16:59:36 2013 +0000
- Revision:
- 1:b211d97b0068
- Parent:
- 0:e979170e02e7
nothing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 0:e979170e02e7 | 1 | /* dsa.h |
ashleymills | 0:e979170e02e7 | 2 | * |
ashleymills | 0:e979170e02e7 | 3 | * Copyright (C) 2006-2012 Sawtooth Consulting Ltd. |
ashleymills | 0:e979170e02e7 | 4 | * |
ashleymills | 0:e979170e02e7 | 5 | * This file is part of CyaSSL. |
ashleymills | 0:e979170e02e7 | 6 | * |
ashleymills | 0:e979170e02e7 | 7 | * CyaSSL is free software; you can redistribute it and/or modify |
ashleymills | 0:e979170e02e7 | 8 | * it under the terms of the GNU General Public License as published by |
ashleymills | 0:e979170e02e7 | 9 | * the Free Software Foundation; either version 2 of the License, or |
ashleymills | 0:e979170e02e7 | 10 | * (at your option) any later version. |
ashleymills | 0:e979170e02e7 | 11 | * |
ashleymills | 0:e979170e02e7 | 12 | * CyaSSL is distributed in the hope that it will be useful, |
ashleymills | 0:e979170e02e7 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ashleymills | 0:e979170e02e7 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ashleymills | 0:e979170e02e7 | 15 | * GNU General Public License for more details. |
ashleymills | 0:e979170e02e7 | 16 | * |
ashleymills | 0:e979170e02e7 | 17 | * You should have received a copy of the GNU General Public License |
ashleymills | 0:e979170e02e7 | 18 | * along with this program; if not, write to the Free Software |
ashleymills | 0:e979170e02e7 | 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
ashleymills | 0:e979170e02e7 | 20 | */ |
ashleymills | 0:e979170e02e7 | 21 | |
ashleymills | 0:e979170e02e7 | 22 | |
ashleymills | 0:e979170e02e7 | 23 | #ifndef NO_DSA |
ashleymills | 0:e979170e02e7 | 24 | |
ashleymills | 0:e979170e02e7 | 25 | #ifndef CTAO_CRYPT_DSA_H |
ashleymills | 0:e979170e02e7 | 26 | #define CTAO_CRYPT_DSA_H |
ashleymills | 0:e979170e02e7 | 27 | |
ashleymills | 0:e979170e02e7 | 28 | #include <cyassl/ctaocrypt/types.h> |
ashleymills | 0:e979170e02e7 | 29 | #include <cyassl/ctaocrypt/integer.h> |
ashleymills | 0:e979170e02e7 | 30 | #include <cyassl/ctaocrypt/random.h> |
ashleymills | 0:e979170e02e7 | 31 | |
ashleymills | 0:e979170e02e7 | 32 | #ifdef __cplusplus |
ashleymills | 0:e979170e02e7 | 33 | extern "C" { |
ashleymills | 0:e979170e02e7 | 34 | #endif |
ashleymills | 0:e979170e02e7 | 35 | |
ashleymills | 0:e979170e02e7 | 36 | |
ashleymills | 0:e979170e02e7 | 37 | enum { |
ashleymills | 0:e979170e02e7 | 38 | DSA_PUBLIC = 0, |
ashleymills | 0:e979170e02e7 | 39 | DSA_PRIVATE = 1 |
ashleymills | 0:e979170e02e7 | 40 | }; |
ashleymills | 0:e979170e02e7 | 41 | |
ashleymills | 0:e979170e02e7 | 42 | /* DSA */ |
ashleymills | 0:e979170e02e7 | 43 | typedef struct DsaKey { |
ashleymills | 0:e979170e02e7 | 44 | mp_int p, q, g, y, x; |
ashleymills | 0:e979170e02e7 | 45 | int type; /* public or private */ |
ashleymills | 0:e979170e02e7 | 46 | } DsaKey; |
ashleymills | 0:e979170e02e7 | 47 | |
ashleymills | 0:e979170e02e7 | 48 | |
ashleymills | 0:e979170e02e7 | 49 | CYASSL_API void InitDsaKey(DsaKey* key); |
ashleymills | 0:e979170e02e7 | 50 | CYASSL_API void FreeDsaKey(DsaKey* key); |
ashleymills | 0:e979170e02e7 | 51 | |
ashleymills | 0:e979170e02e7 | 52 | CYASSL_API int DsaSign(const byte* digest, byte* out, DsaKey* key, RNG* rng); |
ashleymills | 0:e979170e02e7 | 53 | CYASSL_API int DsaVerify(const byte* digest, const byte* sig, DsaKey* key, |
ashleymills | 0:e979170e02e7 | 54 | int* answer); |
ashleymills | 0:e979170e02e7 | 55 | |
ashleymills | 0:e979170e02e7 | 56 | CYASSL_API int DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey*, |
ashleymills | 0:e979170e02e7 | 57 | word32); |
ashleymills | 0:e979170e02e7 | 58 | CYASSL_API int DsaPrivateKeyDecode(const byte* input, word32* inOutIdx, DsaKey*, |
ashleymills | 0:e979170e02e7 | 59 | word32); |
ashleymills | 0:e979170e02e7 | 60 | |
ashleymills | 0:e979170e02e7 | 61 | #ifdef __cplusplus |
ashleymills | 0:e979170e02e7 | 62 | } /* extern "C" */ |
ashleymills | 0:e979170e02e7 | 63 | #endif |
ashleymills | 0:e979170e02e7 | 64 | |
ashleymills | 0:e979170e02e7 | 65 | #endif /* CTAO_CRYPT_DSA_H */ |
ashleymills | 0:e979170e02e7 | 66 | #endif /* NO_DSA */ |
ashleymills | 0:e979170e02e7 | 67 |