Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/ttssh2/ttxssh/ed25519_crypto_api.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10261 - (hide annotations) (download) (as text)
Sun Sep 11 05:26:32 2022 UTC (18 months, 4 weeks ago) by nmaya
File MIME type: text/x-chdr
File size: 3185 byte(s)
OpenSSL のときだけ arc4random.c/h と chacha.c/h が使われるようにした

- LibreSSL のときは compat/stdlib.h を include し LibreSSL の関数を利用する

- RAND_bytes() を呼ぶと LibreSSL の crypto/rand/rand_lib.c の RAND_bytes()
から TTSSH の arc4random.c の arc4random_buf() が呼ばれる状態を解消
1 maya 3227 /*
2 nmaya 9048 * (C) 2004- TeraTerm Project
3 doda 6841 * All rights reserved.
4     *
5     * Redistribution and use in source and binary forms, with or without
6     * modification, are permitted provided that the following conditions
7     * are met:
8     *
9     * 1. Redistributions of source code must retain the above copyright
10     * notice, this list of conditions and the following disclaimer.
11     * 2. Redistributions in binary form must reproduce the above copyright
12     * notice, this list of conditions and the following disclaimer in the
13     * documentation and/or other materials provided with the distribution.
14     * 3. The name of the author may not be used to endorse or promote products
15     * derived from this software without specific prior written permission.
16     *
17     * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20     * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22     * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27     */
28 maya 3227
29 yutakapon 5496 #ifndef __ED25519_CRYPTO_API_H
30     #define __ED25519_CRYPTO_API_H
31 maya 3227
32 yutakapon 5498 #include <stdio.h>
33     #include <stdlib.h>
34    
35 nmaya 10261 #ifndef LIBRESSL_VERSION_NUMBER
36     #include "arc4random.h"
37     #else
38     // include LibreSSL header file
39     #include <compat/stdlib.h>
40     #endif
41    
42 yutakapon 5516 typedef unsigned char u_int8_t;
43     typedef unsigned short int u_int16_t;
44     typedef unsigned int u_int32_t;
45     typedef long long int int64_t;
46     typedef unsigned long long int u_int64_t;
47 yutakapon 5498
48 yutakapon 5516 typedef u_int8_t uint8_t;
49     typedef u_int16_t uint16_t;
50     typedef u_int32_t uint32_t;
51     typedef u_int64_t uint64_t;
52 yutakapon 5498
53 yutakapon 5496 typedef int crypto_int32;
54     typedef unsigned int crypto_uint32;
55 maya 3227
56 yutakapon 5496 #define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len))
57 maya 3227
58 yutakapon 5496 #define crypto_hashblocks_sha512_STATEBYTES 64U
59     #define crypto_hashblocks_sha512_BLOCKBYTES 128U
60 yutakapon 4926
61 yutakapon 5496 int crypto_hashblocks_sha512(unsigned char *, const unsigned char *,
62     unsigned long long);
63 yutakapon 4926
64 yutakapon 5496 #define crypto_hash_sha512_BYTES 64U
65 yutakapon 4926
66 yutakapon 5496 int crypto_hash_sha512(unsigned char *, const unsigned char *,
67     unsigned long long);
68 yutakapon 4926
69 yutakapon 5496 int crypto_verify_32(const unsigned char *, const unsigned char *);
70 yutakapon 4926
71 yutakapon 5496 #define crypto_sign_ed25519_SECRETKEYBYTES 64U
72     #define crypto_sign_ed25519_PUBLICKEYBYTES 32U
73     #define crypto_sign_ed25519_BYTES 64U
74 yutakapon 4926
75 yutakapon 5496 int crypto_sign_ed25519(unsigned char *, unsigned long long *,
76     const unsigned char *, unsigned long long, const unsigned char *);
77     int crypto_sign_ed25519_open(unsigned char *, unsigned long long *,
78     const unsigned char *, unsigned long long, const unsigned char *);
79     int crypto_sign_ed25519_keypair(unsigned char *, unsigned char *);
80 yutakapon 4926
81 yutakapon 5516 int bcrypt_pbkdf(const char *, size_t, const u_int8_t *, size_t,
82     u_int8_t *, size_t, unsigned int);
83 yutakapon 5498
84 maya 3227 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26