Commit 03ff1734 authored by Geoff Simmons's avatar Geoff Simmons

Simplify KEY_Set().

parent aee01e64
...@@ -448,24 +448,18 @@ KEY_Set(VRT_CTX, uint8_t *id, uint8_t idlen, const uint8_t *key) ...@@ -448,24 +448,18 @@ KEY_Set(VRT_CTX, uint8_t *id, uint8_t idlen, const uint8_t *key)
k = key_find(tree_h, id, idlen); k = key_find(tree_h, id, idlen);
if (k == NULL) { if (k == NULL) {
k = key_insert(ctx, id, idlen, key, tree_h); k = key_insert(ctx, id, idlen, key, tree_h);
KEY_Unlock(idlen); if (k == NULL) {
if (k != NULL) { KEY_Unlock(idlen);
CHECK_OBJ(k, KEY_MAGIC);
AN(k->key);
AN(k->id);
AZ(memcmp(k->key, key, AES128_KEYLEN));
assert(k->idlen == idlen);
AZ(memcmp(k->id, id, idlen));
return (0);
}
else
return (-1); return (-1);
}
} }
CHECK_OBJ(k, KEY_MAGIC); CHECK_OBJ(k, KEY_MAGIC);
AN(k->key); AN(k->key);
AZ(memcmp(k->key, key, AES128_KEYLEN));
memcpy(k->key, key, AES128_KEYLEN); memcpy(k->key, key, AES128_KEYLEN);
KEY_Unlock(idlen); KEY_Unlock(idlen);
AN(k->id);
assert(k->idlen == idlen); assert(k->idlen == idlen);
AZ(memcmp(k->id, id, idlen)); AZ(memcmp(k->id, id, idlen));
return (0); return (0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment