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