]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Finish refactoring pkcs11eddsa_link.c after isc_buffer_allocate change.
authorAaron Thompson <dev@aaront.org>
Mon, 30 Mar 2020 00:36:27 +0000 (00:36 +0000)
committerOndřej Surý <ondrej@isc.org>
Mon, 20 Apr 2020 09:40:41 +0000 (11:40 +0200)
Left over after c73e5866c479c71b2fb61e882c249cc2c3de3af0.

lib/dns/pkcs11eddsa_link.c

index 3f2a266e6ee72ee227f99563a51b6cc4ec9bcf06..8cea05c3dd91459a135a8e2a90da5a31a2b2052e 100644 (file)
@@ -73,17 +73,16 @@ pkcs11eddsa_fetch(dst_key_t *key, const char *engine, const char *label,
 static isc_result_t
 pkcs11eddsa_createctx(dst_key_t *key, dst_context_t *dctx) {
        isc_buffer_t *buf = NULL;
-       isc_result_t result;
 
        UNUSED(key);
        REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
                dctx->key->key_alg == DST_ALG_ED448);
 
-       result = isc_buffer_allocate(dctx->mctx, &buf, 16);
+       isc_buffer_allocate(dctx->mctx, &buf, 16);
        isc_buffer_setautorealloc(buf, true);
        dctx->ctxdata.generic = buf;
 
-       return (result);
+       return (ISC_R_SUCCESS);
 }
 
 static void
@@ -101,28 +100,15 @@ pkcs11eddsa_destroyctx(dst_context_t *dctx) {
 static isc_result_t
 pkcs11eddsa_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;
 
        REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
                dctx->key->key_alg == DST_ALG_ED448);
 
        result = isc_buffer_copyregion(buf, data);
-       if (result == ISC_R_SUCCESS) {
-               return (ISC_R_SUCCESS);
-       }
-
-       length = isc_buffer_length(buf) + data->length + 64;
-       isc_buffer_allocate(dctx->mctx, &nbuf, length);
-       isc_buffer_usedregion(buf, &r);
-       (void)isc_buffer_copyregion(nbuf, &r);
-       (void)isc_buffer_copyregion(nbuf, data);
-       isc_buffer_free(&buf);
-       dctx->ctxdata.generic = nbuf;
+       INSIST(result == ISC_R_SUCCESS);
 
-       return (ISC_R_SUCCESS);
+       return (result);
 }
 
 static isc_result_t