Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
wolfssl/wolfcrypt/dsa.h@0:d92f9d21154c, 2015-06-26 (annotated)
- Committer:
- wolfSSL
- Date:
- Fri Jun 26 00:39:20 2015 +0000
- Revision:
- 0:d92f9d21154c
wolfSSL 3.6.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wolfSSL | 0:d92f9d21154c | 1 | /* dsa.h |
wolfSSL | 0:d92f9d21154c | 2 | * |
wolfSSL | 0:d92f9d21154c | 3 | * Copyright (C) 2006-2015 wolfSSL Inc. |
wolfSSL | 0:d92f9d21154c | 4 | * |
wolfSSL | 0:d92f9d21154c | 5 | * This file is part of wolfSSL. (formerly known as CyaSSL) |
wolfSSL | 0:d92f9d21154c | 6 | * |
wolfSSL | 0:d92f9d21154c | 7 | * wolfSSL is free software; you can redistribute it and/or modify |
wolfSSL | 0:d92f9d21154c | 8 | * it under the terms of the GNU General Public License as published by |
wolfSSL | 0:d92f9d21154c | 9 | * the Free Software Foundation; either version 2 of the License, or |
wolfSSL | 0:d92f9d21154c | 10 | * (at your option) any later version. |
wolfSSL | 0:d92f9d21154c | 11 | * |
wolfSSL | 0:d92f9d21154c | 12 | * wolfSSL is distributed in the hope that it will be useful, |
wolfSSL | 0:d92f9d21154c | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
wolfSSL | 0:d92f9d21154c | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wolfSSL | 0:d92f9d21154c | 15 | * GNU General Public License for more details. |
wolfSSL | 0:d92f9d21154c | 16 | * |
wolfSSL | 0:d92f9d21154c | 17 | * You should have received a copy of the GNU General Public License |
wolfSSL | 0:d92f9d21154c | 18 | * along with this program; if not, write to the Free Software |
wolfSSL | 0:d92f9d21154c | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
wolfSSL | 0:d92f9d21154c | 20 | */ |
wolfSSL | 0:d92f9d21154c | 21 | |
wolfSSL | 0:d92f9d21154c | 22 | #ifndef WOLF_CRYPT_DSA_H |
wolfSSL | 0:d92f9d21154c | 23 | #define WOLF_CRYPT_DSA_H |
wolfSSL | 0:d92f9d21154c | 24 | |
wolfSSL | 0:d92f9d21154c | 25 | #include <wolfssl/wolfcrypt/types.h> |
wolfSSL | 0:d92f9d21154c | 26 | |
wolfSSL | 0:d92f9d21154c | 27 | #ifndef NO_DSA |
wolfSSL | 0:d92f9d21154c | 28 | |
wolfSSL | 0:d92f9d21154c | 29 | #include <wolfssl/wolfcrypt/integer.h> |
wolfSSL | 0:d92f9d21154c | 30 | #include <wolfssl/wolfcrypt/random.h> |
wolfSSL | 0:d92f9d21154c | 31 | |
wolfSSL | 0:d92f9d21154c | 32 | /* for DSA reverse compatibility */ |
wolfSSL | 0:d92f9d21154c | 33 | #define InitDsaKey wc_InitDsaKey |
wolfSSL | 0:d92f9d21154c | 34 | #define FreeDsaKey wc_FreeDsaKey |
wolfSSL | 0:d92f9d21154c | 35 | #define DsaSign wc_DsaSign |
wolfSSL | 0:d92f9d21154c | 36 | #define DsaVerify wc_DsaVerify |
wolfSSL | 0:d92f9d21154c | 37 | #define DsaPublicKeyDecode wc_DsaPublicKeyDecode |
wolfSSL | 0:d92f9d21154c | 38 | #define DsaPrivateKeyDecode wc_DsaPrivateKeyDecode |
wolfSSL | 0:d92f9d21154c | 39 | |
wolfSSL | 0:d92f9d21154c | 40 | #ifdef __cplusplus |
wolfSSL | 0:d92f9d21154c | 41 | extern "C" { |
wolfSSL | 0:d92f9d21154c | 42 | #endif |
wolfSSL | 0:d92f9d21154c | 43 | |
wolfSSL | 0:d92f9d21154c | 44 | |
wolfSSL | 0:d92f9d21154c | 45 | enum { |
wolfSSL | 0:d92f9d21154c | 46 | DSA_PUBLIC = 0, |
wolfSSL | 0:d92f9d21154c | 47 | DSA_PRIVATE = 1 |
wolfSSL | 0:d92f9d21154c | 48 | }; |
wolfSSL | 0:d92f9d21154c | 49 | |
wolfSSL | 0:d92f9d21154c | 50 | /* DSA */ |
wolfSSL | 0:d92f9d21154c | 51 | typedef struct DsaKey { |
wolfSSL | 0:d92f9d21154c | 52 | mp_int p, q, g, y, x; |
wolfSSL | 0:d92f9d21154c | 53 | int type; /* public or private */ |
wolfSSL | 0:d92f9d21154c | 54 | } DsaKey; |
wolfSSL | 0:d92f9d21154c | 55 | |
wolfSSL | 0:d92f9d21154c | 56 | |
wolfSSL | 0:d92f9d21154c | 57 | WOLFSSL_API void wc_InitDsaKey(DsaKey* key); |
wolfSSL | 0:d92f9d21154c | 58 | WOLFSSL_API void wc_FreeDsaKey(DsaKey* key); |
wolfSSL | 0:d92f9d21154c | 59 | |
wolfSSL | 0:d92f9d21154c | 60 | WOLFSSL_API int wc_DsaSign(const byte* digest, byte* out, DsaKey* key, RNG* rng); |
wolfSSL | 0:d92f9d21154c | 61 | WOLFSSL_API int wc_DsaVerify(const byte* digest, const byte* sig, DsaKey* key, |
wolfSSL | 0:d92f9d21154c | 62 | int* answer); |
wolfSSL | 0:d92f9d21154c | 63 | |
wolfSSL | 0:d92f9d21154c | 64 | WOLFSSL_API int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey*, |
wolfSSL | 0:d92f9d21154c | 65 | word32); |
wolfSSL | 0:d92f9d21154c | 66 | WOLFSSL_API int wc_DsaPrivateKeyDecode(const byte* input, word32* inOutIdx, DsaKey*, |
wolfSSL | 0:d92f9d21154c | 67 | word32); |
wolfSSL | 0:d92f9d21154c | 68 | |
wolfSSL | 0:d92f9d21154c | 69 | #ifdef __cplusplus |
wolfSSL | 0:d92f9d21154c | 70 | } /* extern "C" */ |
wolfSSL | 0:d92f9d21154c | 71 | #endif |
wolfSSL | 0:d92f9d21154c | 72 | |
wolfSSL | 0:d92f9d21154c | 73 | #endif /* NO_DSA */ |
wolfSSL | 0:d92f9d21154c | 74 | #endif /* WOLF_CRYPT_DSA_H */ |
wolfSSL | 0:d92f9d21154c | 75 | |
wolfSSL | 0:d92f9d21154c | 76 |