source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/blake2/blake2_locl.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 2.6 KB
Line 
1/*
2 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10/*
11 * Derived from the BLAKE2 reference implementation written by Samuel Neves.
12 * Copyright 2012, Samuel Neves <sneves@dei.uc.pt>
13 * More information about the BLAKE2 hash function and its implementations
14 * can be found at https://blake2.net.
15 */
16
17#include <stddef.h>
18#include "e_os.h"
19
20#define BLAKE2S_BLOCKBYTES 64
21#define BLAKE2S_OUTBYTES 32
22#define BLAKE2S_KEYBYTES 32
23#define BLAKE2S_SALTBYTES 8
24#define BLAKE2S_PERSONALBYTES 8
25
26#define BLAKE2B_BLOCKBYTES 128
27#define BLAKE2B_OUTBYTES 64
28#define BLAKE2B_KEYBYTES 64
29#define BLAKE2B_SALTBYTES 16
30#define BLAKE2B_PERSONALBYTES 16
31
32struct blake2s_param_st {
33 uint8_t digest_length; /* 1 */
34 uint8_t key_length; /* 2 */
35 uint8_t fanout; /* 3 */
36 uint8_t depth; /* 4 */
37 uint8_t leaf_length[4];/* 8 */
38 uint8_t node_offset[6];/* 14 */
39 uint8_t node_depth; /* 15 */
40 uint8_t inner_length; /* 16 */
41 uint8_t salt[BLAKE2S_SALTBYTES]; /* 24 */
42 uint8_t personal[BLAKE2S_PERSONALBYTES]; /* 32 */
43};
44
45typedef struct blake2s_param_st BLAKE2S_PARAM;
46
47struct blake2s_ctx_st {
48 uint32_t h[8];
49 uint32_t t[2];
50 uint32_t f[2];
51 uint8_t buf[BLAKE2S_BLOCKBYTES];
52 size_t buflen;
53};
54
55struct blake2b_param_st {
56 uint8_t digest_length; /* 1 */
57 uint8_t key_length; /* 2 */
58 uint8_t fanout; /* 3 */
59 uint8_t depth; /* 4 */
60 uint8_t leaf_length[4];/* 8 */
61 uint8_t node_offset[8];/* 16 */
62 uint8_t node_depth; /* 17 */
63 uint8_t inner_length; /* 18 */
64 uint8_t reserved[14]; /* 32 */
65 uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */
66 uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
67};
68
69typedef struct blake2b_param_st BLAKE2B_PARAM;
70
71struct blake2b_ctx_st {
72 uint64_t h[8];
73 uint64_t t[2];
74 uint64_t f[2];
75 uint8_t buf[BLAKE2B_BLOCKBYTES];
76 size_t buflen;
77};
78
79#define BLAKE2B_DIGEST_LENGTH 64
80#define BLAKE2S_DIGEST_LENGTH 32
81
82typedef struct blake2s_ctx_st BLAKE2S_CTX;
83typedef struct blake2b_ctx_st BLAKE2B_CTX;
84
85int BLAKE2b_Init(BLAKE2B_CTX *c);
86int BLAKE2b_Update(BLAKE2B_CTX *c, const void *data, size_t datalen);
87int BLAKE2b_Final(unsigned char *md, BLAKE2B_CTX *c);
88
89int BLAKE2s_Init(BLAKE2S_CTX *c);
90int BLAKE2s_Update(BLAKE2S_CTX *c, const void *data, size_t datalen);
91int BLAKE2s_Final(unsigned char *md, BLAKE2S_CTX *c);
Note: See TracBrowser for help on using the repository browser.