-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest-stdlib.c
More file actions
36 lines (32 loc) · 1.08 KB
/
test-stdlib.c
File metadata and controls
36 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// BLAKE2 - size-optimized implementations
//
// Copyright 2012, Samuel Neves <sneves@dei.uc.pt> (original work)
// Copyright 2018, Ayke van Laethem
//
// You may use this under the terms of the CC0, the OpenSSL Licence, or
// the Apache Public License 2.0, at your option. The terms of these
// licenses can be found at:
//
// - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
// - OpenSSL license : https://www.openssl.org/source/license.html
// - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
//
// More information about the BLAKE2 hash function can be found at
// https://blake2.net.
#include <string.h>
// Very compact implementations of builtin/stdlib functions
void *memset(void *s, int c, size_t n) {
unsigned char *buf = s;
for (void *end = buf + n; buf != end; buf++) {
*buf = c;
}
return s;
}
void *memcpy(void *dest, const void *src, size_t n) {
unsigned char *destbuf = dest;
const unsigned char *srcbuf = src;
for (size_t i = 0; i < n; i++) {
destbuf[i] = srcbuf[i];
}
return dest;
}