pki: Replace BUILD_FROM_FD with passing a chunk via BUILD_BLOB
This allows more than one builder to try parsing the data read from STDIN.
This commit is contained in:
@@ -380,9 +380,13 @@ static int issue()
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
cert_req = lib->creds->create(lib->creds, CRED_CERTIFICATE,
|
||||
CERT_PKCS10_REQUEST,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
if (!cert_req)
|
||||
{
|
||||
@@ -419,8 +423,12 @@ static int issue()
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
}
|
||||
if (!public)
|
||||
|
||||
@@ -87,8 +87,12 @@ static int keyid()
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
cred = lib->creds->create(lib->creds, type, subtype,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
if (!cred)
|
||||
{
|
||||
|
||||
@@ -338,7 +338,7 @@ static void print_crl(crl_t *crl)
|
||||
|
||||
if (crl->is_delta_crl(crl, &chunk))
|
||||
{
|
||||
chunk = chunk_skip_zero(chunk);
|
||||
chunk = chunk_skip_zero(chunk);
|
||||
printf("delta CRL: for serial %#B\n", &chunk);
|
||||
}
|
||||
chunk = crl->get_authKeyIdentifier(crl);
|
||||
@@ -508,8 +508,12 @@ static int print()
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
cred = lib->creds->create(lib->creds, type, subtype,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
if (!cred)
|
||||
{
|
||||
|
||||
@@ -101,13 +101,17 @@ static int pub()
|
||||
|
||||
chunk = chunk_from_hex(chunk_create(keyid, strlen(keyid)), NULL);
|
||||
cred = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_ANY,
|
||||
BUILD_PKCS11_KEYID, chunk, BUILD_END);
|
||||
BUILD_PKCS11_KEYID, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
cred = lib->creds->create(lib->creds, type, subtype,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
|
||||
if (type == CRED_PRIVATE_KEY)
|
||||
|
||||
@@ -116,8 +116,12 @@ static int req()
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, type,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
if (!private)
|
||||
{
|
||||
|
||||
@@ -271,8 +271,12 @@ static int self()
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, type,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
if (!private)
|
||||
{
|
||||
|
||||
@@ -55,8 +55,12 @@ static int verify()
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk_t chunk;
|
||||
|
||||
chunk = chunk_from_fd(0);
|
||||
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509,
|
||||
BUILD_FROM_FD, 0, BUILD_END);
|
||||
BUILD_BLOB, chunk, BUILD_END);
|
||||
free(chunk.ptr);
|
||||
}
|
||||
if (!cert)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user