mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
apply the modified style
This commit is contained in:
@@ -55,9 +55,8 @@ static const unsigned char ed25519_pub_prefix[] = { 0x30, 0x2a, 0x30, 0x05,
|
||||
0x70, 0x03, 0x21, 0x00 };
|
||||
|
||||
static EVP_PKEY *
|
||||
pub_ed25519_to_ossl(const unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
pub_ed25519_to_ossl(const unsigned char *key) {
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
const unsigned char *p;
|
||||
|
||||
memmove(buf, ed25519_pub_prefix, PUBPREFIXLEN);
|
||||
@@ -67,11 +66,10 @@ pub_ed25519_to_ossl(const unsigned char *key)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
pub_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
pub_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
unsigned char *p;
|
||||
int len;
|
||||
int len;
|
||||
|
||||
len = i2d_PUBKEY(pkey, NULL);
|
||||
if ((len <= DNS_KEY_ED25519SIZE) ||
|
||||
@@ -96,9 +94,8 @@ static const unsigned char ed25519_priv_prefix[] = { 0x30, 0x2e, 0x02, 0x01,
|
||||
0x04, 0x22, 0x04, 0x20 };
|
||||
|
||||
static EVP_PKEY *
|
||||
priv_ed25519_to_ossl(const unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
priv_ed25519_to_ossl(const unsigned char *key) {
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
const unsigned char *p;
|
||||
|
||||
memmove(buf, ed25519_priv_prefix, PRIVPREFIXLEN);
|
||||
@@ -109,11 +106,10 @@ priv_ed25519_to_ossl(const unsigned char *key)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
priv_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
priv_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED25519SIZE];
|
||||
unsigned char *p;
|
||||
int len;
|
||||
int len;
|
||||
|
||||
len = i2d_PrivateKey(pkey, NULL);
|
||||
if ((len <= DNS_KEY_ED25519SIZE) ||
|
||||
@@ -133,30 +129,26 @@ priv_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
#else /* HAVE_OPENSSL_ED25519 */
|
||||
|
||||
static EVP_PKEY *
|
||||
pub_ed25519_to_ossl(const unsigned char *key)
|
||||
{
|
||||
pub_ed25519_to_ossl(const unsigned char *key) {
|
||||
UNUSED(key);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
pub_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
pub_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
UNUSED(pkey);
|
||||
UNUSED(key);
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
static EVP_PKEY *
|
||||
priv_ed25519_to_ossl(const unsigned char *key)
|
||||
{
|
||||
priv_ed25519_to_ossl(const unsigned char *key) {
|
||||
UNUSED(key);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
priv_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
priv_ed25519_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
UNUSED(pkey);
|
||||
UNUSED(key);
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
@@ -175,9 +167,8 @@ static const unsigned char ed448_pub_prefix[] = { 0x30, 0x43, 0x30, 0x05,
|
||||
0x71, 0x03, 0x3a, 0x00 };
|
||||
|
||||
static EVP_PKEY *
|
||||
pub_ed448_to_ossl(const unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
pub_ed448_to_ossl(const unsigned char *key) {
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
const unsigned char *p;
|
||||
|
||||
memmove(buf, ed448_pub_prefix, PUBPREFIXLEN);
|
||||
@@ -187,11 +178,10 @@ pub_ed448_to_ossl(const unsigned char *key)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
pub_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
pub_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
unsigned char buf[PUBPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
unsigned char *p;
|
||||
int len;
|
||||
int len;
|
||||
|
||||
len = i2d_PUBKEY(pkey, NULL);
|
||||
if ((len <= DNS_KEY_ED448SIZE) ||
|
||||
@@ -214,9 +204,8 @@ static const unsigned char ed448_priv_prefix[] = { 0x30, 0x47, 0x02, 0x01,
|
||||
0x04, 0x3b, 0x04, 0x39 };
|
||||
|
||||
static EVP_PKEY *
|
||||
priv_ed448_to_ossl(const unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
priv_ed448_to_ossl(const unsigned char *key) {
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
const unsigned char *p;
|
||||
|
||||
memmove(buf, ed448_priv_prefix, PRIVPREFIXLEN);
|
||||
@@ -227,11 +216,10 @@ priv_ed448_to_ossl(const unsigned char *key)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
priv_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
priv_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
unsigned char buf[PRIVPREFIXLEN + DNS_KEY_ED448SIZE];
|
||||
unsigned char *p;
|
||||
int len;
|
||||
int len;
|
||||
|
||||
len = i2d_PrivateKey(pkey, NULL);
|
||||
if ((len <= DNS_KEY_ED448SIZE) ||
|
||||
@@ -251,30 +239,26 @@ priv_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
#else /* HAVE_OPENSSL_ED448 */
|
||||
|
||||
static EVP_PKEY *
|
||||
pub_ed448_to_ossl(const unsigned char *key)
|
||||
{
|
||||
pub_ed448_to_ossl(const unsigned char *key) {
|
||||
UNUSED(key);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
pub_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
pub_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
UNUSED(pkey);
|
||||
UNUSED(key);
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
static EVP_PKEY *
|
||||
priv_ed448_to_ossl(const unsigned char *key)
|
||||
{
|
||||
priv_ed448_to_ossl(const unsigned char *key) {
|
||||
UNUSED(key);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
priv_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
{
|
||||
priv_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key) {
|
||||
UNUSED(pkey);
|
||||
UNUSED(key);
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
@@ -282,12 +266,11 @@ priv_ed448_from_ossl(EVP_PKEY *pkey, unsigned char *key)
|
||||
|
||||
#endif /* HAVE_OPENSSL_ED448 */
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data);
|
||||
static isc_result_t openssleddsa_todns(const dst_key_t *key,
|
||||
isc_buffer_t *data);
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_createctx(dst_key_t *key, dst_context_t *dctx)
|
||||
{
|
||||
openssleddsa_createctx(dst_key_t *key, dst_context_t *dctx) {
|
||||
isc_buffer_t *buf = NULL;
|
||||
|
||||
UNUSED(key);
|
||||
@@ -301,8 +284,7 @@ openssleddsa_createctx(dst_key_t *key, dst_context_t *dctx)
|
||||
}
|
||||
|
||||
static void
|
||||
openssleddsa_destroyctx(dst_context_t *dctx)
|
||||
{
|
||||
openssleddsa_destroyctx(dst_context_t *dctx) {
|
||||
isc_buffer_t *buf = (isc_buffer_t *)dctx->ctxdata.generic;
|
||||
|
||||
REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
|
||||
@@ -314,13 +296,12 @@ openssleddsa_destroyctx(dst_context_t *dctx)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_adddata(dst_context_t *dctx, const isc_region_t *data)
|
||||
{
|
||||
openssleddsa_adddata(dst_context_t *dctx, const isc_region_t *data) {
|
||||
isc_buffer_t *buf = (isc_buffer_t *)dctx->ctxdata.generic;
|
||||
isc_buffer_t *nbuf = NULL;
|
||||
isc_region_t r;
|
||||
unsigned int length;
|
||||
isc_result_t result;
|
||||
isc_region_t r;
|
||||
unsigned int length;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
|
||||
dctx->key->key_alg == DST_ALG_ED448);
|
||||
@@ -342,16 +323,15 @@ openssleddsa_adddata(dst_context_t *dctx, const isc_region_t *data)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_sign(dst_context_t *dctx, isc_buffer_t *sig)
|
||||
{
|
||||
isc_result_t ret;
|
||||
dst_key_t * key = dctx->key;
|
||||
isc_region_t tbsreg;
|
||||
isc_region_t sigreg;
|
||||
EVP_PKEY * pkey = key->keydata.pkey;
|
||||
EVP_MD_CTX * ctx = EVP_MD_CTX_new();
|
||||
openssleddsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
||||
isc_result_t ret;
|
||||
dst_key_t *key = dctx->key;
|
||||
isc_region_t tbsreg;
|
||||
isc_region_t sigreg;
|
||||
EVP_PKEY *pkey = key->keydata.pkey;
|
||||
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
|
||||
isc_buffer_t *buf = (isc_buffer_t *)dctx->ctxdata.generic;
|
||||
size_t siglen;
|
||||
size_t siglen;
|
||||
|
||||
REQUIRE(key->key_alg == DST_ALG_ED25519 ||
|
||||
key->key_alg == DST_ALG_ED448);
|
||||
@@ -394,16 +374,15 @@ err:
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_verify(dst_context_t *dctx, const isc_region_t *sig)
|
||||
{
|
||||
isc_result_t ret;
|
||||
dst_key_t * key = dctx->key;
|
||||
int status;
|
||||
isc_region_t tbsreg;
|
||||
EVP_PKEY * pkey = key->keydata.pkey;
|
||||
EVP_MD_CTX * ctx = EVP_MD_CTX_new();
|
||||
openssleddsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
||||
isc_result_t ret;
|
||||
dst_key_t *key = dctx->key;
|
||||
int status;
|
||||
isc_region_t tbsreg;
|
||||
EVP_PKEY *pkey = key->keydata.pkey;
|
||||
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
|
||||
isc_buffer_t *buf = (isc_buffer_t *)dctx->ctxdata.generic;
|
||||
unsigned int siglen = 0;
|
||||
unsigned int siglen = 0;
|
||||
|
||||
REQUIRE(key->key_alg == DST_ALG_ED25519 ||
|
||||
key->key_alg == DST_ALG_ED448);
|
||||
@@ -462,9 +441,8 @@ err:
|
||||
}
|
||||
|
||||
static bool
|
||||
openssleddsa_compare(const dst_key_t *key1, const dst_key_t *key2)
|
||||
{
|
||||
int status;
|
||||
openssleddsa_compare(const dst_key_t *key1, const dst_key_t *key2) {
|
||||
int status;
|
||||
EVP_PKEY *pkey1 = key1->keydata.pkey;
|
||||
EVP_PKEY *pkey2 = key2->keydata.pkey;
|
||||
|
||||
@@ -482,12 +460,11 @@ openssleddsa_compare(const dst_key_t *key1, const dst_key_t *key2)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_generate(dst_key_t *key, int unused, void (*callback)(int))
|
||||
{
|
||||
isc_result_t ret;
|
||||
EVP_PKEY * pkey = NULL;
|
||||
openssleddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
|
||||
isc_result_t ret;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
EVP_PKEY_CTX *ctx = NULL;
|
||||
int nid = 0, status;
|
||||
int nid = 0, status;
|
||||
|
||||
REQUIRE(key->key_alg == DST_ALG_ED25519 ||
|
||||
key->key_alg == DST_ALG_ED448);
|
||||
@@ -537,10 +514,9 @@ err:
|
||||
}
|
||||
|
||||
static bool
|
||||
openssleddsa_isprivate(const dst_key_t *key)
|
||||
{
|
||||
EVP_PKEY * pkey = key->keydata.pkey;
|
||||
int len;
|
||||
openssleddsa_isprivate(const dst_key_t *key) {
|
||||
EVP_PKEY *pkey = key->keydata.pkey;
|
||||
int len;
|
||||
unsigned long err;
|
||||
|
||||
if (pkey == NULL) {
|
||||
@@ -560,8 +536,7 @@ openssleddsa_isprivate(const dst_key_t *key)
|
||||
}
|
||||
|
||||
static void
|
||||
openssleddsa_destroy(dst_key_t *key)
|
||||
{
|
||||
openssleddsa_destroy(dst_key_t *key) {
|
||||
EVP_PKEY *pkey = key->keydata.pkey;
|
||||
|
||||
EVP_PKEY_free(pkey);
|
||||
@@ -569,9 +544,8 @@ openssleddsa_destroy(dst_key_t *key)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data)
|
||||
{
|
||||
EVP_PKEY * pkey = key->keydata.pkey;
|
||||
openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data) {
|
||||
EVP_PKEY *pkey = key->keydata.pkey;
|
||||
isc_region_t r;
|
||||
isc_result_t result;
|
||||
|
||||
@@ -606,9 +580,8 @@ openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_fromdns(dst_key_t *key, isc_buffer_t *data)
|
||||
{
|
||||
EVP_PKEY * pkey;
|
||||
openssleddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
||||
EVP_PKEY *pkey;
|
||||
isc_region_t r;
|
||||
unsigned int len;
|
||||
|
||||
@@ -642,13 +615,12 @@ openssleddsa_fromdns(dst_key_t *key, isc_buffer_t *data)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_tofile(const dst_key_t *key, const char *directory)
|
||||
{
|
||||
isc_result_t ret;
|
||||
EVP_PKEY * pkey;
|
||||
dst_private_t priv;
|
||||
openssleddsa_tofile(const dst_key_t *key, const char *directory) {
|
||||
isc_result_t ret;
|
||||
EVP_PKEY *pkey;
|
||||
dst_private_t priv;
|
||||
unsigned char *buf = NULL;
|
||||
unsigned int len;
|
||||
unsigned int len;
|
||||
|
||||
REQUIRE(key->key_alg == DST_ALG_ED25519 ||
|
||||
key->key_alg == DST_ALG_ED448);
|
||||
@@ -697,8 +669,7 @@ err:
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
eddsa_check(EVP_PKEY *privkey, dst_key_t *pub)
|
||||
{
|
||||
eddsa_check(EVP_PKEY *privkey, dst_key_t *pub) {
|
||||
EVP_PKEY *pkey;
|
||||
|
||||
if (pub == NULL) {
|
||||
@@ -715,13 +686,12 @@ eddsa_check(EVP_PKEY *privkey, dst_key_t *pub)
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
openssleddsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub)
|
||||
{
|
||||
openssleddsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
||||
dst_private_t priv;
|
||||
isc_result_t ret;
|
||||
EVP_PKEY * pkey = NULL;
|
||||
unsigned int len;
|
||||
isc_mem_t * mctx = key->mctx;
|
||||
isc_result_t ret;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
unsigned int len;
|
||||
isc_mem_t *mctx = key->mctx;
|
||||
|
||||
REQUIRE(key->key_alg == DST_ALG_ED25519 ||
|
||||
key->key_alg == DST_ALG_ED448);
|
||||
@@ -801,8 +771,7 @@ static dst_func_t openssleddsa_functions = {
|
||||
};
|
||||
|
||||
isc_result_t
|
||||
dst__openssleddsa_init(dst_func_t **funcp)
|
||||
{
|
||||
dst__openssleddsa_init(dst_func_t **funcp) {
|
||||
REQUIRE(funcp != NULL);
|
||||
if (*funcp == NULL) {
|
||||
*funcp = &openssleddsa_functions;
|
||||
|
Reference in New Issue
Block a user