]> git.proxmox.com Git - ovs.git/blob - lib/sha1.h
ofproto: Make current packet counts more accurate.
[ovs.git] / lib / sha1.h
1 /*
2 * This file is from the Apache Portable Runtime Library.
3 * The full upstream copyright and license statement is included below.
4 * Modifications copyright (c) 2009 Nicira Networks.
5 */
6
7 /* Licensed to the Apache Software Foundation (ASF) under one or more
8 * contributor license agreements. See the NOTICE file distributed with
9 * this work for additional information regarding copyright ownership.
10 * The ASF licenses this file to You under the Apache License, Version 2.0
11 * (the "License"); you may not use this file except in compliance with
12 * the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22 /* NIST Secure Hash Algorithm
23 * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
24 * from Peter C. Gutmann's implementation as found in
25 * Applied Cryptography by Bruce Schneier
26 * This code is hereby placed in the public domain
27 */
28
29 #ifndef SHA1_H
30 #define SHA1_H
31
32 #include <stddef.h>
33 #include <stdint.h>
34
35 /* Size of the SHA1 digest. */
36 #define SHA1_DIGEST_SIZE 20
37
38 /* SHA1 context structure. */
39 struct sha1_ctx {
40 uint32_t digest[5]; /* Message digest. */
41 uint32_t count_lo, count_hi; /* 64-bit bit counts. */
42 uint32_t data[16]; /* SHA data buffer */
43 int local; /* Unprocessed amount in data. */
44 };
45
46 void sha1_init(struct sha1_ctx *);
47 void sha1_update(struct sha1_ctx *, const void *, size_t);
48 void sha1_final(struct sha1_ctx *, uint8_t digest[SHA1_DIGEST_SIZE]);
49 void sha1_bytes(const void *, size_t, uint8_t digest[SHA1_DIGEST_SIZE]);
50
51 #endif /* sha1.h */