Lines Matching defs:output
95 * \param output
100 pgp_write_ss_header(pgp_output_t *output,
104 return pgp_write_length(output, length) &&
105 pgp_write_scalar(output, (unsigned)(type -
134 * \param output
138 pgp_write_struct_userid(pgp_output_t *output, const uint8_t *id)
140 return pgp_write_ptag(output, PGP_PTAG_CT_USER_ID) &&
141 pgp_write_length(output, (unsigned)strlen((const char *) id)) &&
142 pgp_write(output, id, (unsigned)strlen((const char *) id));
149 * \param output
154 pgp_write_userid(const uint8_t *userid, pgp_output_t *output)
156 return pgp_write_struct_userid(output, userid);
230 write_pubkey_body(const pgp_pubkey_t *key, pgp_output_t *output)
232 if (!(pgp_write_scalar(output, (unsigned)key->version, 1) &&
233 pgp_write_scalar(output, (unsigned)key->birthtime, 4))) {
238 !pgp_write_scalar(output, key->days_valid, 2)) {
242 if (!pgp_write_scalar(output, (unsigned)key->alg, 1)) {
248 return pgp_write_mpi(output, key->key.dsa.p) &&
249 pgp_write_mpi(output, key->key.dsa.q) &&
250 pgp_write_mpi(output, key->key.dsa.g) &&
251 pgp_write_mpi(output, key->key.dsa.y);
254 return pgp_write(output, &key->key.ecdsa.len, 1) &&
255 pgp_write(output, key->key.ecdsa.oid, key->key.ecdsa.len) &&
256 pgp_write_mpi(output, key->key.ecdsa.p);
261 return pgp_write_mpi(output, key->key.rsa.n) &&
262 pgp_write_mpi(output, key->key.rsa.e);
265 return pgp_write_mpi(output, key->key.elgamal.p) &&
266 pgp_write_mpi(output, key->key.elgamal.g) &&
267 pgp_write_mpi(output, key->key.elgamal.y);
285 pgp_output_t *output)
296 if (!write_pubkey_body(&key->pubkey, output)) {
303 if (!pgp_write_scalar(output, (unsigned)key->s2k_usage, 1)) {
311 if (!pgp_write_scalar(output, (unsigned)key->alg, 1)) {
321 if (!pgp_write_scalar(output, (unsigned)key->s2k_specifier, 1)) {
324 if (!pgp_write_scalar(output, (unsigned)key->hash_alg, 1)) {
336 if (!pgp_write(output, key->salt, PGP_SALT_SIZE)) {
353 if (!pgp_write(output, &key->iv[0], pgp_block_size(key->alg))) {
446 pgp_push_enc_crypt(output, &crypted);
452 if (!pgp_write_mpi(output, key->key.rsa.d) ||
453 !pgp_write_mpi(output, key->key.rsa.p) ||
454 !pgp_write_mpi(output, key->key.rsa.q) ||
455 !pgp_write_mpi(output, key->key.rsa.u)) {
464 return pgp_write_mpi(output, key->key.dsa.x);
466 return pgp_write_mpi(output, key->key.elgamal.x);
471 if (!pgp_write(output, key->checkhash, PGP_CHECKHASH_SIZE)) {
475 pgp_writer_pop(output);
484 * \param output
488 write_struct_pubkey(pgp_output_t *output, const pgp_pubkey_t *key)
490 return pgp_write_ptag(output, PGP_PTAG_CT_PUBLIC_KEY) &&
491 pgp_write_length(output, 1 + 4 + 1 + pubkey_length(key)) &&
492 write_pubkey_body(key, output);
499 \brief Writes a transferable PGP public key to the given output stream.
502 \param armoured Flag is set for armoured output
503 \param output Output stream
508 pgp_write_xfer_pubkey(pgp_output_t *output,
515 pgp_writer_push_armoured(output, PGP_PGP_PUBLIC_KEY_BLOCK);
518 if (!write_struct_pubkey(output, &key->key.pubkey)) {
526 if (!pgp_write_struct_userid(output, key->uids[i])) {
530 if (!pgp_write(output, key->packets[j].raw, (unsigned)key->packets[j].length)) {
544 pgp_writer_info_finalise(&output->errors, &output->writer);
545 pgp_writer_pop(output);
553 \brief Writes a transferable PGP secret key to the given output stream.
558 \param armoured Flag is set for armoured output
559 \param output Output stream
564 pgp_write_xfer_seckey(pgp_output_t *output,
573 pgp_writer_push_armoured(output, PGP_PGP_PRIVATE_KEY_BLOCK);
577 pplen, output)) {
585 if (!pgp_write_struct_userid(output, key->uids[i])) {
589 if (!pgp_write(output, key->packets[j].raw, (unsigned)key->packets[j].length)) {
603 pgp_writer_info_finalise(&output->errors, &output->writer);
604 pgp_writer_pop(output);
615 * \param output Writer settings
623 pgp_output_t *output)
628 return write_struct_pubkey(output, &key);
642 pgp_output_t *output;
644 output = pgp_output_new();
646 pgp_writer_set_memory(output, out);
647 write_pubkey_body(key, output);
651 pgp_output_delete(output);
697 * \param output
704 pgp_output_t *output)
784 return pgp_write_ptag(output, PGP_PTAG_CT_SECRET_KEY) &&
785 /* pgp_write_length(output,1+4+1+1+seckey_length(key)+2) && */
786 pgp_write_length(output, (unsigned)length) &&
787 write_seckey_body(key, passphrase, pplen, output);
815 pgp_output_delete(pgp_output_t *output)
817 pgp_writer_info_delete(&output->writer);
818 free(output);
1085 pgp_write_pk_sesskey(pgp_output_t *output, pgp_pk_sesskey_t *pksk)
1095 return pgp_write_ptag(output, PGP_PTAG_CT_PK_SESSION_KEY) &&
1096 pgp_write_length(output, (unsigned)(1 + 8 + 1 +
1098 pgp_write_scalar(output, (unsigned)pksk->version, 1) &&
1099 pgp_write(output, pksk->key_id, 8) &&
1100 pgp_write_scalar(output, (unsigned)pksk->alg, 1) &&
1101 pgp_write_mpi(output, pksk->params.rsa.encrypted_m)
1102 /* ?? && pgp_write_scalar(output, 0, 2); */
1106 return pgp_write_ptag(output, PGP_PTAG_CT_PK_SESSION_KEY) &&
1107 pgp_write_length(output, (unsigned)(1 + 8 + 1 +
1110 pgp_write_scalar(output, (unsigned)pksk->version, 1) &&
1111 pgp_write(output, pksk->key_id, 8) &&
1112 pgp_write_scalar(output, (unsigned)pksk->alg, 1) &&
1113 pgp_write_mpi(output, pksk->params.elgamal.g_to_k) &&
1114 pgp_write_mpi(output, pksk->params.elgamal.encrypted_m)
1115 /* ?? && pgp_write_scalar(output, 0, 2); */
1128 \param output Write settings
1133 pgp_write_mdc(pgp_output_t *output, const uint8_t *hashed)
1136 return pgp_write_ptag(output, PGP_PTAG_CT_MDC) &&
1137 pgp_write_length(output, PGP_SHA1_HASH_SIZE) &&
1138 pgp_write(output, hashed, PGP_SHA1_HASH_SIZE);
1147 \param output Write settings
1151 pgp_write_litdata(pgp_output_t *output,
1162 return pgp_write_ptag(output, PGP_PTAG_CT_LITDATA) &&
1163 pgp_write_length(output, (unsigned)(1 + 1 + 4 + maxlen)) &&
1164 pgp_write_scalar(output, (unsigned)type, 1) &&
1165 pgp_write_scalar(output, 0, 1) &&
1166 pgp_write_scalar(output, 0, 4) &&
1167 pgp_write(output, data, (unsigned)maxlen);
1175 \param output Write settings
1182 pgp_output_t *output)
1194 ret = pgp_write_litdata(output, pgp_mem_data(mem), len, type);
1245 \param output Write settings
1252 pgp_output_t * output)
1277 return pgp_write_ptag(output, PGP_PTAG_CT_SE_DATA) &&
1278 pgp_write_length(output, (unsigned)(1 + encrypted_sz)) &&
1279 pgp_write(output, data, (unsigned)len);
1288 \param output Write settings
1292 pgp_write_one_pass_sig(pgp_output_t *output,
1300 return pgp_write_ptag(output, PGP_PTAG_CT_1_PASS_SIG) &&
1301 pgp_write_length(output, 1 + 1 + 1 + 1 + 8 + 1) &&
1302 pgp_write_scalar(output, 3, 1) /* version */ &&
1303 pgp_write_scalar(output, (unsigned)sig_type, 1) &&
1304 pgp_write_scalar(output, (unsigned)hash_alg, 1) &&
1305 pgp_write_scalar(output, (unsigned)seckey->pubkey.alg, 1) &&
1306 pgp_write(output, keyid, 8) &&
1307 pgp_write_scalar(output, 1, 1);