1#ifndef MYSQL_SERVICE_SHA1_INCLUDED
2/* Copyright (c) 2013, 2014, Monty Program Ab
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
17/**
18 @file
19 my sha1 service
20
21 Functions to calculate SHA1 hash from a memory buffer
22*/
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#ifndef MYSQL_ABI_CHECK
29#include <stdlib.h>
30#endif
31
32#define MY_SHA1_HASH_SIZE 20 /* Hash size in bytes */
33
34extern struct my_sha1_service_st {
35 void (*my_sha1_type)(unsigned char*, const char*, size_t);
36 void (*my_sha1_multi_type)(unsigned char*, ...);
37 size_t (*my_sha1_context_size_type)();
38 void (*my_sha1_init_type)(void *);
39 void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
40 void (*my_sha1_result_type)(void *, unsigned char *);
41} *my_sha1_service;
42
43#ifdef MYSQL_DYNAMIC_PLUGIN
44
45#define my_sha1(A,B,C) my_sha1_service->my_sha1_type(A,B,C)
46#define my_sha1_multi my_sha1_service->my_sha1_multi_type
47#define my_sha1_context_size() my_sha1_service->my_sha1_context_size_type()
48#define my_sha1_init(A) my_sha1_service->my_sha1_init_type(A)
49#define my_sha1_input(A,B,C) my_sha1_service->my_sha1_input_type(A,B,C)
50#define my_sha1_result(A,B) my_sha1_service->my_sha1_result_type(A,B)
51
52#else
53
54void my_sha1(unsigned char*, const char*, size_t);
55void my_sha1_multi(unsigned char*, ...);
56size_t my_sha1_context_size();
57void my_sha1_init(void *context);
58void my_sha1_input(void *context, const unsigned char *buf, size_t len);
59void my_sha1_result(void *context, unsigned char *digest);
60
61#endif
62
63#ifdef __cplusplus
64}
65#endif
66
67#define MYSQL_SERVICE_SHA1_INCLUDED
68#endif
69
70