ssh lib
wolfcrypt/signature.h@1:e4ea39eba2fb, 2019-11-25 (annotated)
- Committer:
- sPymbed
- Date:
- Mon Nov 25 14:23:49 2019 +0000
- Revision:
- 1:e4ea39eba2fb
- Parent:
- 0:1387ff3eed4a
improved
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sPymbed | 0:1387ff3eed4a | 1 | /* signature.h |
sPymbed | 0:1387ff3eed4a | 2 | * |
sPymbed | 0:1387ff3eed4a | 3 | * Copyright (C) 2006-2017 wolfSSL Inc. |
sPymbed | 0:1387ff3eed4a | 4 | * |
sPymbed | 0:1387ff3eed4a | 5 | * This file is part of wolfSSL. |
sPymbed | 0:1387ff3eed4a | 6 | * |
sPymbed | 0:1387ff3eed4a | 7 | * wolfSSL is free software; you can redistribute it and/or modify |
sPymbed | 0:1387ff3eed4a | 8 | * it under the terms of the GNU General Public License as published by |
sPymbed | 0:1387ff3eed4a | 9 | * the Free Software Foundation; either version 2 of the License, or |
sPymbed | 0:1387ff3eed4a | 10 | * (at your option) any later version. |
sPymbed | 0:1387ff3eed4a | 11 | * |
sPymbed | 0:1387ff3eed4a | 12 | * wolfSSL is distributed in the hope that it will be useful, |
sPymbed | 0:1387ff3eed4a | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
sPymbed | 0:1387ff3eed4a | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
sPymbed | 0:1387ff3eed4a | 15 | * GNU General Public License for more details. |
sPymbed | 0:1387ff3eed4a | 16 | * |
sPymbed | 0:1387ff3eed4a | 17 | * You should have received a copy of the GNU General Public License |
sPymbed | 0:1387ff3eed4a | 18 | * along with this program; if not, write to the Free Software |
sPymbed | 0:1387ff3eed4a | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
sPymbed | 0:1387ff3eed4a | 20 | */ |
sPymbed | 0:1387ff3eed4a | 21 | |
sPymbed | 0:1387ff3eed4a | 22 | /*! |
sPymbed | 0:1387ff3eed4a | 23 | \file wolfssl/wolfcrypt/signature.h |
sPymbed | 0:1387ff3eed4a | 24 | */ |
sPymbed | 0:1387ff3eed4a | 25 | |
sPymbed | 0:1387ff3eed4a | 26 | |
sPymbed | 0:1387ff3eed4a | 27 | #ifndef WOLF_CRYPT_SIGNATURE_H |
sPymbed | 0:1387ff3eed4a | 28 | #define WOLF_CRYPT_SIGNATURE_H |
sPymbed | 0:1387ff3eed4a | 29 | |
sPymbed | 0:1387ff3eed4a | 30 | #include <wolfcrypt/types.h> |
sPymbed | 0:1387ff3eed4a | 31 | #include <wolfcrypt/hash.h> |
sPymbed | 0:1387ff3eed4a | 32 | #include <wolfcrypt/random.h> |
sPymbed | 0:1387ff3eed4a | 33 | |
sPymbed | 0:1387ff3eed4a | 34 | #ifdef __cplusplus |
sPymbed | 0:1387ff3eed4a | 35 | extern "C" { |
sPymbed | 0:1387ff3eed4a | 36 | #endif |
sPymbed | 0:1387ff3eed4a | 37 | |
sPymbed | 0:1387ff3eed4a | 38 | enum wc_SignatureType { |
sPymbed | 0:1387ff3eed4a | 39 | WC_SIGNATURE_TYPE_NONE = 0, |
sPymbed | 0:1387ff3eed4a | 40 | WC_SIGNATURE_TYPE_ECC = 1, |
sPymbed | 0:1387ff3eed4a | 41 | WC_SIGNATURE_TYPE_RSA = 2, |
sPymbed | 0:1387ff3eed4a | 42 | WC_SIGNATURE_TYPE_RSA_W_ENC = 3, /* Adds DER header via wc_EncodeSignature */ |
sPymbed | 0:1387ff3eed4a | 43 | }; |
sPymbed | 0:1387ff3eed4a | 44 | |
sPymbed | 0:1387ff3eed4a | 45 | WOLFSSL_API int wc_SignatureGetSize(enum wc_SignatureType sig_type, |
sPymbed | 0:1387ff3eed4a | 46 | const void* key, word32 key_len); |
sPymbed | 0:1387ff3eed4a | 47 | |
sPymbed | 0:1387ff3eed4a | 48 | WOLFSSL_API int wc_SignatureVerifyHash( |
sPymbed | 0:1387ff3eed4a | 49 | enum wc_HashType hash_type, enum wc_SignatureType sig_type, |
sPymbed | 0:1387ff3eed4a | 50 | const byte* hash_data, word32 hash_len, |
sPymbed | 0:1387ff3eed4a | 51 | const byte* sig, word32 sig_len, |
sPymbed | 0:1387ff3eed4a | 52 | const void* key, word32 key_len); |
sPymbed | 0:1387ff3eed4a | 53 | |
sPymbed | 0:1387ff3eed4a | 54 | WOLFSSL_API int wc_SignatureVerify( |
sPymbed | 0:1387ff3eed4a | 55 | enum wc_HashType hash_type, enum wc_SignatureType sig_type, |
sPymbed | 0:1387ff3eed4a | 56 | const byte* data, word32 data_len, |
sPymbed | 0:1387ff3eed4a | 57 | const byte* sig, word32 sig_len, |
sPymbed | 0:1387ff3eed4a | 58 | const void* key, word32 key_len); |
sPymbed | 0:1387ff3eed4a | 59 | |
sPymbed | 0:1387ff3eed4a | 60 | WOLFSSL_API int wc_SignatureGenerateHash( |
sPymbed | 0:1387ff3eed4a | 61 | enum wc_HashType hash_type, enum wc_SignatureType sig_type, |
sPymbed | 0:1387ff3eed4a | 62 | const byte* hash_data, word32 hash_len, |
sPymbed | 0:1387ff3eed4a | 63 | byte* sig, word32 *sig_len, |
sPymbed | 0:1387ff3eed4a | 64 | const void* key, word32 key_len, WC_RNG* rng); |
sPymbed | 0:1387ff3eed4a | 65 | WOLFSSL_API int wc_SignatureGenerate( |
sPymbed | 0:1387ff3eed4a | 66 | enum wc_HashType hash_type, enum wc_SignatureType sig_type, |
sPymbed | 0:1387ff3eed4a | 67 | const byte* data, word32 data_len, |
sPymbed | 0:1387ff3eed4a | 68 | byte* sig, word32 *sig_len, |
sPymbed | 0:1387ff3eed4a | 69 | const void* key, word32 key_len, |
sPymbed | 0:1387ff3eed4a | 70 | WC_RNG* rng); |
sPymbed | 0:1387ff3eed4a | 71 | |
sPymbed | 0:1387ff3eed4a | 72 | #ifdef __cplusplus |
sPymbed | 0:1387ff3eed4a | 73 | } /* extern "C" */ |
sPymbed | 0:1387ff3eed4a | 74 | #endif |
sPymbed | 0:1387ff3eed4a | 75 | |
sPymbed | 0:1387ff3eed4a | 76 | #endif /* WOLF_CRYPT_SIGNATURE_H */ |
sPymbed | 0:1387ff3eed4a | 77 |