SHA1.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2018, 2019 Wind River Systems, Inc. All Rights Reserved.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v2.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  * https://www.eclipse.org/legal/epl-2.0/
10  * and the Eclipse Distribution License is available at
11  * http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  * Keith Holman - initial implementation and documentation
15  *******************************************************************************/
16 
17 #if !defined(SHA1_H)
18 #define SHA1_H
19 
20 #if defined(OPENSSL)
21 #include <openssl/sha.h>
22 
24 #define SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH
25 
26 #else /* if defined(OPENSSL) */
27 
28 #if defined(_WIN32) || defined(_WIN64)
29 #include <windows.h>
30 #include <wincrypt.h>
31 typedef struct SHA_CTX_S
32 {
33  HCRYPTPROV hProv;
34  HCRYPTHASH hHash;
35 } SHA_CTX;
36 #else /* if defined(_WIN32) || defined(_WIN64) */
37 
38 #include <stdint.h>
39 typedef struct SHA_CTX_S {
40  uint32_t h[5];
41  union {
42  uint32_t w[16];
43  uint8_t buffer[64];
44  };
45  unsigned int size;
46  unsigned int total;
47 } SHA_CTX;
48 #endif /* else if defined(_WIN32) || defined(_WIN64) */
49 
50 #include <stddef.h>
51 
53 #define SHA1_DIGEST_LENGTH (160/8)
54 
63 int SHA1_Init(SHA_CTX *ctx);
64 
75 int SHA1_Update(SHA_CTX *ctx, const void *data, size_t len);
76 
87 int SHA1_Final(unsigned char *md, SHA_CTX *ctx);
88 
89 #endif /* if defined(OPENSSL) */
90 #endif /* SHA1_H */
91 
uint32_t h[5]
Definition: SHA1.h:40
uint32_t w[16]
Definition: SHA1.h:42
Definition: SHA1.h:39
int SHA1_Final(unsigned char *md, SHA_CTX *ctx)
Definition: SHA1.c:139
unsigned int size
Definition: SHA1.h:45
struct SHA_CTX_S SHA_CTX
unsigned int total
Definition: SHA1.h:46
int SHA1_Update(SHA_CTX *ctx, const void *data, size_t len)
Definition: SHA1.c:173
dictionary data
Definition: mqtt_test.py:22
uint8_t buffer[64]
Definition: SHA1.h:43
int SHA1_Init(SHA_CTX *ctx)
Definition: SHA1.c:77
int len
Definition: utf-8.c:46


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:11