-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ChaCha20 with LibreSSL
- Loading branch information
1 parent
2d33543
commit 17d8181
Showing
4 changed files
with
141 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"asn1", | ||
"bignum", | ||
"bio", | ||
"chacha", | ||
"cmac", | ||
"crypto", | ||
"dh", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This file is dual licensed under the terms of the Apache License, Version | ||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository | ||
# for complete details. | ||
|
||
from __future__ import annotations | ||
|
||
INCLUDES = """ | ||
#if CRYPTOGRAPHY_IS_LIBRESSL | ||
#include <openssl/chacha.h> | ||
#endif""" | ||
|
||
TYPES = """ | ||
static const long Cryptography_HAS_CHACHA20_API; | ||
""" | ||
|
||
FUNCTIONS = """ | ||
void Cryptography_CRYPTO_chacha_20(uint8_t *, const uint8_t *, size_t, | ||
const uint8_t[32], const uint8_t[8], | ||
uint64_t); | ||
""" | ||
|
||
CUSTOMIZATIONS = """ | ||
#if CRYPTOGRAPHY_IS_LIBRESSL | ||
static const long Cryptography_HAS_CHACHA20_API = 1; | ||
#else | ||
static const long Cryptography_HAS_CHACHA20_API = 0; | ||
#endif | ||
#if CRYPTOGRAPHY_IS_LIBRESSL | ||
void Cryptography_CRYPTO_chacha_20(uint8_t *out, const uint8_t *in, | ||
size_t in_len, const uint8_t key[32], | ||
const uint8_t nonce[8], uint64_t counter) { | ||
CRYPTO_chacha_20(out, in, in_len, key, nonce, counter); | ||
} | ||
#else | ||
void (*Cryptography_CRYPTO_chacha_20)(uint8_t *, const uint8_t *, size_t, const uint8_t[32], | ||
const uint8_t[8], uint64_t) = NULL; | ||
#endif | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters