Browse Subversion Repository
Contents of /trunk/ttssh2/ttxssh/chacha.h
Parent Directory
| Revision Log
Revision 7040 -
( show annotations)
( download)
( as text)
Wed Feb 21 03:01:34 2018 UTC
(6 years ago)
by doda
File MIME type: text/x-chdr
File size: 810 byte(s)
ChaCha20 の実装を変更
旧: openbsd-compat/chacha_private.h
新: chacha.c, chacha.h
どちらも OpenSSH 由来
| 1 |
/* Imported via OpenSSH-7.6p1, TeraTerm Project doda */ |
| 2 |
|
| 3 |
/* $OpenBSD: chacha.h,v 1.4 2016/08/27 04:04:56 guenther Exp $ */ |
| 4 |
|
| 5 |
/* |
| 6 |
chacha-merged.c version 20080118 |
| 7 |
D. J. Bernstein |
| 8 |
Public domain. |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef CHACHA_H |
| 12 |
#define CHACHA_H |
| 13 |
|
| 14 |
#include <sys/types.h> |
| 15 |
#include <stdlib.h> |
| 16 |
|
| 17 |
typedef unsigned int u_int; |
| 18 |
typedef unsigned char u_char; |
| 19 |
|
| 20 |
struct chacha_ctx { |
| 21 |
u_int input[16]; |
| 22 |
}; |
| 23 |
|
| 24 |
#define CHACHA_MINKEYLEN 16 |
| 25 |
#define CHACHA_NONCELEN 8 |
| 26 |
#define CHACHA_CTRLEN 8 |
| 27 |
#define CHACHA_STATELEN (CHACHA_NONCELEN+CHACHA_CTRLEN) |
| 28 |
#define CHACHA_BLOCKLEN 64 |
| 29 |
|
| 30 |
void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits); |
| 31 |
void chacha_ivsetup(struct chacha_ctx *x, const u_char *iv, const u_char *ctr); |
| 32 |
void chacha_encrypt_bytes(struct chacha_ctx *x, const u_char *m, u_char *c, u_int bytes); |
| 33 |
|
| 34 |
#endif /* CHACHA_H */ |
| 35 |
|
|