Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:16

0001 /* pkcs1.h
0002 
0003    PKCS1 embedding.
0004 
0005    Copyright (C) 2003 Niels Möller
0006 
0007    This file is part of GNU Nettle.
0008 
0009    GNU Nettle is free software: you can redistribute it and/or
0010    modify it under the terms of either:
0011 
0012      * the GNU Lesser General Public License as published by the Free
0013        Software Foundation; either version 3 of the License, or (at your
0014        option) any later version.
0015 
0016    or
0017 
0018      * the GNU General Public License as published by the Free
0019        Software Foundation; either version 2 of the License, or (at your
0020        option) any later version.
0021 
0022    or both in parallel, as here.
0023 
0024    GNU Nettle is distributed in the hope that it will be useful,
0025    but WITHOUT ANY WARRANTY; without even the implied warranty of
0026    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0027    General Public License for more details.
0028 
0029    You should have received copies of the GNU General Public License and
0030    the GNU Lesser General Public License along with this program.  If
0031    not, see http://www.gnu.org/licenses/.
0032 */
0033 
0034 #ifndef NETTLE_PKCS1_H_INCLUDED
0035 #define NETTLE_PKCS1_H_INCLUDED
0036 
0037 #include "nettle-types.h"
0038 #include "bignum.h"
0039 
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043 
0044 /* Name mangling */
0045 #define pkcs1_rsa_digest_encode nettle_pkcs1_rsa_digest_encode
0046 #define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_encode
0047 #define pkcs1_rsa_md5_encode_digest nettle_pkcs1_rsa_md5_encode_digest
0048 #define pkcs1_rsa_sha1_encode nettle_pkcs1_rsa_sha1_encode
0049 #define pkcs1_rsa_sha1_encode_digest nettle_pkcs1_rsa_sha1_encode_digest
0050 #define pkcs1_rsa_sha256_encode nettle_pkcs1_rsa_sha256_encode
0051 #define pkcs1_rsa_sha256_encode_digest nettle_pkcs1_rsa_sha256_encode_digest
0052 #define pkcs1_rsa_sha512_encode nettle_pkcs1_rsa_sha512_encode
0053 #define pkcs1_rsa_sha512_encode_digest nettle_pkcs1_rsa_sha512_encode_digest
0054 #define pkcs1_encrypt nettle_pkcs1_encrypt
0055 #define pkcs1_decrypt nettle_pkcs1_decrypt
0056 
0057 struct md5_ctx;
0058 struct sha1_ctx;
0059 struct sha256_ctx;
0060 struct sha512_ctx;
0061 
0062 int
0063 pkcs1_encrypt (size_t key_size,
0064            /* For padding */
0065            void *random_ctx, nettle_random_func *random,
0066            size_t length, const uint8_t *message,
0067            mpz_t m);
0068 
0069 int
0070 pkcs1_decrypt (size_t key_size,
0071            const mpz_t m,
0072            size_t *length, uint8_t *message);
0073 
0074 int
0075 pkcs1_rsa_digest_encode(mpz_t m, size_t key_size,
0076             size_t di_length, const uint8_t *digest_info);
0077 
0078 int
0079 pkcs1_rsa_md5_encode(mpz_t m, size_t length, struct md5_ctx *hash);
0080 
0081 int
0082 pkcs1_rsa_md5_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
0083 
0084 int
0085 pkcs1_rsa_sha1_encode(mpz_t m, size_t length, struct sha1_ctx *hash);
0086 
0087 int
0088 pkcs1_rsa_sha1_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
0089 
0090 int
0091 pkcs1_rsa_sha256_encode(mpz_t m, size_t length, struct sha256_ctx *hash);
0092 
0093 int
0094 pkcs1_rsa_sha256_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
0095 
0096 int
0097 pkcs1_rsa_sha512_encode(mpz_t m, size_t length, struct sha512_ctx *hash);
0098 
0099 int
0100 pkcs1_rsa_sha512_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
0101 
0102 #ifdef __cplusplus
0103 }
0104 #endif
0105 
0106 #endif /* NETTLE_PKCS1_H_INCLUDED */