BN_free(Y);
return NULL;
}
+#ifndef S_SPLINT_S
dsa->p = P;
dsa->q = Q;
dsa->g = G;
dsa->pub_key = Y;
+#endif /* splint */
return dsa;
}
BN_free(modulus);
return NULL;
}
+#ifndef S_SPLINT_S
rsa->n = modulus;
rsa->e = exponent;
+#endif /* splint */
return rsa;
}
return NULL;
}
tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX,
- EVP_MD_size(md),
+ (size_t)EVP_MD_size(md),
digest);
ldns_rr_push_rdf(ds, tmp);
#endif
ldns_rr *nsec = NULL;
ldns_rr_type i_type_list[65536];
- int type_count = 0;
+ size_t type_count = 0;
nsec = ldns_rr_new();
ldns_rr_set_type(nsec, LDNS_RR_TYPE_NSEC);
ldns_status status;
ldns_rr_type i_type_list[1024];
- int type_count = 0;
+ size_t type_count = 0;
hashed_owner = ldns_nsec3_hash_name(cur_owner,
algorithm,
}
BN_bn2bin(ecdsa_sig->r, data);
BN_bn2bin(ecdsa_sig->s, data+BN_num_bytes(ecdsa_sig->r));
- rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64,
- BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s), data);
+ rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, (size_t)(
+ BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s)), data);
ECDSA_SIG_free(ecdsa_sig);
return rdf;
}
{
ECDSA_SIG* sig;
int raw_sig_len;
- long bnsize = ldns_rdf_size(sig_rdf) / 2;
+ long bnsize = (long)ldns_rdf_size(sig_rdf) / 2;
/* if too short, or not even length, do not bother */
if(bnsize < 16 || (size_t)bnsize*2 != ldns_rdf_size(sig_rdf))
return LDNS_STATUS_ERR;
raw_sig_len = i2d_ECDSA_SIG(sig, NULL);
if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) {
- unsigned char* pp = ldns_buffer_current(target_buffer);
+ unsigned char* pp = (unsigned char*)
+ ldns_buffer_current(target_buffer);
raw_sig_len = i2d_ECDSA_SIG(sig, &pp);
- ldns_buffer_skip(target_buffer, (size_t) raw_sig_len);
+ ldns_buffer_skip(target_buffer, (ssize_t) raw_sig_len);
}
ECDSA_SIG_free(sig);
switch(ldns_key_algorithm(current_key)) {
case LDNS_SIGN_DSA:
- case LDNS_DSA_NSEC3:
+ case LDNS_SIGN_DSA_NSEC3:
b64rdf = ldns_sign_public_evp(
sign_buf,
ldns_key_evp_key(current_key),
}
#ifdef USE_ECDSA
+#ifndef S_SPLINT_S
static int
ldns_pkey_is_ecdsa(EVP_PKEY* pkey)
{
EC_KEY_free(ec);
return 0;
}
+#endif /* splint */
#endif /* USE_ECDSA */
ldns_rdf *
}
/* unfortunately, OpenSSL output is differenct from DNS DSA format */
+#ifndef S_SPLINT_S
if (EVP_PKEY_type(key->type) == EVP_PKEY_DSA) {
sigdata_rdf = ldns_convert_dsa_rrsig_asn12rdf(b64sig, siglen);
#ifdef USE_ECDSA
sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen,
ldns_buffer_begin(b64sig));
}
+#endif /* splint */
ldns_buffer_free(b64sig);
EVP_MD_CTX_cleanup(&ctx);
return sigdata_rdf;
next_name,
LDNS_RR_TYPE_NSEC);
ldns_rr_set_ttl(nsec_rr, nsec_ttl);
- ldns_dnssec_name_add_rr(cur_name, nsec_rr);
+ if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){
+ ldns_rr_free(nsec_rr);
+ return LDNS_STATUS_ERR;
+ }
ldns_rr_list_push_rr(new_rrs, nsec_rr);
cur_node = next_node;
if (cur_node) {
next_name,
LDNS_RR_TYPE_NSEC);
ldns_rr_set_ttl(nsec_rr, nsec_ttl);
- ldns_dnssec_name_add_rr(cur_name, nsec_rr);
+ if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){
+ ldns_rr_free(nsec_rr);
+ return LDNS_STATUS_ERR;
+ }
ldns_rr_list_push_rr(new_rrs, nsec_rr);
} else {
printf("error\n");
ldns_rdf_deep_free(ldns_rr_pop_rdf(nsec_rr));
}
ldns_rr_set_ttl(nsec_rr, nsec_ttl);
- ldns_dnssec_name_add_rr(current_name, nsec_rr);
+ result = ldns_dnssec_name_add_rr(current_name, nsec_rr);
ldns_rr_list_push_rr(new_rrs, nsec_rr);
ldns_rr_list_push_rr(nsec3_list, nsec_rr);
current_name_node = ldns_dnssec_name_node_next_nonglue(
ldns_rbtree_next(current_name_node));
}
+ if (result != LDNS_STATUS_OK) {
+ return result;
+ }
ldns_rr_list_sort_nsec3(nsec3_list);
- ldns_dnssec_chain_nsec3_list(nsec3_list);
+ result = ldns_dnssec_chain_nsec3_list(nsec3_list);
if (result != LDNS_STATUS_OK) {
return result;
}
siglist = ldns_sign_public(rr_list, key_list);
for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) {
if (cur_rrset->signatures) {
- ldns_dnssec_rrs_add_rr(cur_rrset->signatures,
+ result = ldns_dnssec_rrs_add_rr(cur_rrset->signatures,
ldns_rr_list_rr(siglist,
i));
} else {
for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) {
if (cur_name->nsec_signatures) {
- ldns_dnssec_rrs_add_rr(cur_name->nsec_signatures,
+ result = ldns_dnssec_rrs_add_rr(cur_name->nsec_signatures,
ldns_rr_list_rr(siglist, i));
} else {
cur_name->nsec_signatures = ldns_dnssec_rrs_new();
}
/* zone is already sorted */
- ldns_dnssec_zone_mark_glue(zone);
+ result = ldns_dnssec_zone_mark_glue(zone);
+ if (result != LDNS_STATUS_OK) {
+ return result;
+ }
/* check whether we need to add nsecs */
if (zone->names && !((ldns_dnssec_name *)zone->names->root->data)->nsec) {
ldns_status result = LDNS_STATUS_OK;
/* zone is already sorted */
- ldns_dnssec_zone_mark_glue(zone);
+ result = ldns_dnssec_zone_mark_glue(zone);
+ if (result != LDNS_STATUS_OK) {
+ return result;
+ }
/* TODO if there are already nsec3s presents and their
* parameters are the same as these, we don't have to recreate
*/
if (zone->names) {
/* add empty nonterminals */
- ldns_dnssec_zone_add_empty_nonterminals(zone);
+ result = ldns_dnssec_zone_add_empty_nonterminals(zone);
+ if (result != LDNS_STATUS_OK) {
+ return result;
+ }
nsec3 = ((ldns_dnssec_name *)zone->names->root->data)->nsec;
if (nsec3 && ldns_rr_get_type(nsec3) == LDNS_RR_TYPE_NSEC3) {
/* always set bit 7 of the flags to zero, according to
* rfc5155 section 11 */
ldns_set_bit(ldns_rdf_data(ldns_rr_rdf(nsec3params, 1)), 7, 0);
- ldns_dnssec_zone_add_rr(zone, nsec3params);
+ result = ldns_dnssec_zone_add_rr(zone, nsec3params);
+ if (result != LDNS_STATUS_OK) {
+ return result;
+ }
ldns_rr_list_push_rr(new_rrs, nsec3params);
}
result = ldns_dnssec_zone_create_nsec3s(zone,
memmove(encoded+37, key, 64);
pp = (unsigned char*)&encoded[0];
- return d2i_PUBKEY(NULL, &pp, sizeof(encoded));
+ return d2i_PUBKEY(NULL, &pp, (int)sizeof(encoded));
}
static ldns_status
* of openssl) for uncompressed data */
buf[0] = POINT_CONVERSION_UNCOMPRESSED;
memmove(buf+1, key, keylen);
- if(!o2i_ECPublicKey(&ec, &pp, keylen+1)) {
+ if(!o2i_ECPublicKey(&ec, &pp, (int)keylen+1)) {
EC_KEY_free(ec);
return NULL;
}
ldns_dnssec_name *new_name = ldns_dnssec_name_new();
new_name->name = ldns_rr_owner(rr);
- ldns_dnssec_name_add_rr(new_name, rr);
+ if(ldns_dnssec_name_add_rr(new_name, rr) != LDNS_STATUS_OK) {
+ ldns_dnssec_name_free(new_name);
+ return NULL;
+ }
return new_name;
}
} else if (typecovered == LDNS_RR_TYPE_NSEC ||
typecovered == LDNS_RR_TYPE_NSEC3) {
if (name->nsec_signatures) {
- ldns_dnssec_rrs_add_rr(name->nsec_signatures, rr);
+ result = ldns_dnssec_rrs_add_rr(name->nsec_signatures, rr);
} else {
name->nsec_signatures = ldns_dnssec_rrs_new();
name->nsec_signatures->rr = rr;
}
}
-static inline void
-print_indent(FILE *out, int c)
-{
- int i;
- for (i=0; i<c; i++) {
- fprintf(out, " ");
- }
-}
-
void
ldns_dnssec_name_print_soa(FILE *out, ldns_dnssec_name *name, bool show_soa)
{
}
cur_node->key = ldns_rr_owner(rr);
cur_node->data = cur_name;
- ldns_rbtree_insert(zone->names, cur_node);
+ (void)ldns_rbtree_insert(zone->names, cur_node);
} else {
cur_name = (ldns_dnssec_name *) cur_node->data;
- ldns_dnssec_name_add_rr(cur_name, rr);
+ result = ldns_dnssec_name_add_rr(cur_name, rr);
}
if (result != LDNS_STATUS_OK) {
* label in the current name (counting from the end)
*/
for (i = 1; i < next_label_count - soa_label_count; i++) {
- lpos = cur_label_count - next_label_count + i;
+ lpos = (int)cur_label_count - (int)next_label_count + (int)i;
if (lpos >= 0) {
- l1 = ldns_dname_label(cur_name, lpos);
+ l1 = ldns_dname_label(cur_name, (uint8_t)lpos);
} else {
l1 = NULL;
}
}
new_node->key = new_name->name;
new_node->data = new_name;
- ldns_rbtree_insert(zone->names, new_node);
+ (void)ldns_rbtree_insert(zone->names, new_node);
}
ldns_rdf_deep_free(l1);
ldns_rdf_deep_free(l2);
break;
}
}
- strlcpy(addr, word, LDNS_MAX_LINELEN+1);
+ (void)strlcpy(addr, word, LDNS_MAX_LINELEN+1);
} else {
/* la al la la */
if (ip6) {
uint8_t prefix;
bool negation;
uint8_t adf_length;
- unsigned short i;
- unsigned int pos = 0;
+ size_t i;
+ size_t pos = 0;
while (pos < (unsigned int) ldns_rdf_size(rdf)) {
- if(pos + 3 >= ldns_rdf_size(rdf))
+ if(pos + 3 >= (unsigned)ldns_rdf_size(rdf))
return LDNS_STATUS_SYNTAX_RDATA_ERR;
address_family = ldns_read_uint16(&data[pos]);
prefix = data[pos + 2];
ldns_buffer_printf(output, "GostAsn1: ");
ret = i2d_PrivateKey(p, &pp);
- b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, ret, pp);
+ b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, (size_t)ret, pp);
status = ldns_rdf2buffer_str(output, b64_bignum);
ldns_rdf_deep_free(b64_bignum);
{
ldns_status status = LDNS_STATUS_OK;
unsigned char *bignum;
+#ifndef S_SPLINT_S
+ uint16_t i;
+#endif
#ifdef HAVE_SSL
/* not used when ssl is not defined */
ldns_rdf *b64_bignum = NULL;
- uint16_t i;
RSA *rsa;
DSA *dsa;
/* print to buf, convert to bin, convert to b64,
* print to buf */
ldns_buffer_printf(output, "Modulus: ");
+#ifndef S_SPLINT_S
i = (uint16_t)BN_bn2bin(rsa->n, bignum);
if (i > LDNS_MAX_KEYLEN) {
goto error;
} else {
ldns_buffer_printf(output, "(Not available)\n");
}
+#endif /* splint */
RSA_free(rsa);
break;
/* print to buf, convert to bin, convert to b64,
* print to buf */
ldns_buffer_printf(output, "Prime(p): ");
+#ifndef S_SPLINT_S
if (dsa->p) {
i = (uint16_t)BN_bn2bin(dsa->p, bignum);
if (i > LDNS_MAX_KEYLEN) {
} else {
printf("(Not available)\n");
}
+#endif /* splint */
break;
case LDNS_SIGN_ECC_GOST:
/* no format defined, use blob */
#if defined(HAVE_SSL) && defined(USE_GOST)
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: %d (ECC-GOST)\n", LDNS_SIGN_ECC_GOST);
- status = ldns_gost_key2buffer_str(output, k->_key.key);
+ status = ldns_gost_key2buffer_str(output,
+#ifndef S_SPLINT_S
+ k->_key.key
+#else
+ NULL
+#endif
+ );
+
#endif
break;
#ifdef USE_ECDSA
case LDNS_SIGN_ECDSAP384SHA384:
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: %d (", ldns_key_algorithm(k));
- ldns_algorithm2buffer_str(output, ldns_key_algorithm(k));
+ status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k));
+#ifndef S_SPLINT_S
ldns_buffer_printf(output, ")\n");
if(k->_key.key) {
EC_KEY* ec = EVP_PKEY_get1_EC_KEY(k->_key.key);
* its still assigned to the PKEY */
EC_KEY_free(ec);
}
+#endif /* splint */
break;
#endif
case LDNS_SIGN_HMACMD5:
rr_count = ldns_rr_list_rr_count(rr_list);
for(i = 0; i < rr_count; i++) {
- ldns_rr2buffer_wire(buffer, ldns_rr_list_rr(rr_list, i),
+ (void)ldns_rr2buffer_wire(buffer, ldns_rr_list_rr(rr_list, i),
LDNS_SECTION_ANY);
}
return ldns_buffer_status(buffer);
(void)ldns_rr2buffer_wire(buffer, edns_rr, LDNS_SECTION_ADDITIONAL);
/* take the edns rdata back out of the rr before we free rr */
if (packet->_edns_data)
- ldns_rr_pop_rdf (edns_rr);
+ (void)ldns_rr_pop_rdf (edns_rr);
ldns_rr_free(edns_rr);
}
k = ldns_key_new();
if(!k) return LDNS_STATUS_MEM_ERR;
+#ifndef S_SPLINT_S
k->_key.key = ENGINE_load_private_key(e, key_id, UI_OpenSSL(), NULL);
if(!k->_key.key) {
ldns_key_free(k);
if (!k->_key.key) {
ldns_key_free(k);
return LDNS_STATUS_ENGINE_KEY_NOT_LOADED;
- } else {
- *key = k;
- return LDNS_STATUS_OK;
- }
+ }
+#endif /* splint */
+ *key = k;
+ return LDNS_STATUS_OK;
}
#endif
if(ldns_str2rdf_b64(&b64rdf, token) != LDNS_STATUS_OK)
return NULL;
pp = (unsigned char*)ldns_rdf_data(b64rdf);
- pkey = d2i_PrivateKey(gost_id, NULL, &pp, ldns_rdf_size(b64rdf));
+ pkey = d2i_PrivateKey(gost_id, NULL, &pp, (int)ldns_rdf_size(b64rdf));
ldns_rdf_deep_free(b64rdf);
return pkey;
}
ldns_rdf_deep_free(b64rdf);
return NULL;
}
- bn = BN_bin2bn(pp, ldns_rdf_size(b64rdf), NULL);
+ bn = BN_bin2bn(pp, (int)ldns_rdf_size(b64rdf), NULL);
ldns_rdf_deep_free(b64rdf);
if(!bn) {
EC_KEY_free(ec);
}
#ifdef USE_ECDSA
if (strncmp(d, "13 ECDSAP256SHA256", 3) == 0) {
- alg = LDNS_ECDSAP256SHA256;
+ alg = LDNS_SIGN_ECDSAP256SHA256;
}
if (strncmp(d, "14 ECDSAP384SHA384", 3) == 0) {
- alg = LDNS_ECDSAP384SHA384;
+ alg = LDNS_SIGN_ECDSAP384SHA384;
}
#endif
if (strncmp(d, "157 HMAC-MD5", 4) == 0) {
switch(alg) {
case LDNS_SIGN_RSAMD5:
case LDNS_SIGN_RSASHA1:
- case LDNS_RSASHA1_NSEC3:
+ case LDNS_SIGN_RSASHA1_NSEC3:
#ifdef USE_SHA2
case LDNS_SIGN_RSASHA256:
case LDNS_SIGN_RSASHA512:
#endif /* HAVE_SSL */
break;
case LDNS_SIGN_DSA:
- case LDNS_DSA_NSEC3:
+ case LDNS_SIGN_DSA_NSEC3:
ldns_key_set_algorithm(k, alg);
#ifdef HAVE_SSL
dsa = ldns_key_new_frm_fp_dsa_l(fp, line_nr);
}
ldns_key_set_evp_key(k,
ldns_key_new_frm_fp_gost_l(fp, line_nr));
+#ifndef S_SPLINT_S
if(!k->_key.key) {
ldns_key_free(k);
return LDNS_STATUS_ERR;
}
+#endif /* splint */
#endif
break;
#ifdef USE_ECDSA
case LDNS_SIGN_ECDSAP384SHA384:
ldns_key_set_algorithm(k, alg);
ldns_key_set_evp_key(k,
- ldns_key_new_frm_fp_ecdsa_l(fp, alg, line_nr));
+ ldns_key_new_frm_fp_ecdsa_l(fp, (ldns_algorithm)alg, line_nr));
+#ifndef S_SPLINT_S
if(!k->_key.key) {
ldns_key_free(k);
return LDNS_STATUS_ERR;
}
+#endif /* splint */
break;
#endif
default:
goto error;
}
i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d)));
+#ifndef S_SPLINT_S
rsa->n = BN_bin2bn((const char unsigned*)buf, i, NULL);
if (!rsa->n) {
goto error;
if (!rsa->iqmp) {
goto error;
}
+#endif /* splint */
LDNS_FREE(buf);
LDNS_FREE(d);
goto error;
}
i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d)));
+#ifndef S_SPLINT_S
dsa->p = BN_bin2bn((const char unsigned*)buf, i, NULL);
if (!dsa->p) {
goto error;
if (!dsa->pub_key) {
goto error;
}
+#endif /* splint */
LDNS_FREE(buf);
LDNS_FREE(d);
case LDNS_SIGN_HMACSHA1:
case LDNS_SIGN_HMACSHA256:
#ifdef HAVE_SSL
+#ifndef S_SPLINT_S
k->_key.key = NULL;
+#endif /* splint */
#endif /* HAVE_SSL */
size = size / 8;
ldns_key_set_hmac_size(k, size);
case LDNS_SIGN_ECC_GOST:
#if defined(HAVE_SSL) && defined(USE_GOST)
ldns_key_set_evp_key(k, ldns_gen_gost_key());
+#ifndef S_SPLINT_S
if(!k->_key.key) {
ldns_key_free(k);
return NULL;
}
+#endif /* splint */
#endif /* HAVE_SSL and USE_GOST */
break;
#ifdef USE_ECDSA
- case LDNS_ECDSAP256SHA256:
- case LDNS_ECDSAP384SHA384:
+ case LDNS_SIGN_ECDSAP256SHA256:
+ case LDNS_SIGN_ECDSAP384SHA384:
if(alg == LDNS_SIGN_ECDSAP256SHA256)
ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
else if(alg == LDNS_SIGN_ECDSAP384SHA384)
EC_KEY_free(ec);
return NULL;
}
+#ifndef S_SPLINT_S
k->_key.key = EVP_PKEY_new();
if(!k->_key.key) {
ldns_key_free(k);
return NULL;
}
EVP_PKEY_assign_EC_KEY(k->_key.key, ec);
+#endif /* splint */
break;
#endif
}
}
#ifdef HAVE_SSL
+#ifndef S_SPLINT_S
void
ldns_key_set_evp_key(ldns_key *k, EVP_PKEY *e)
{
EVP_PKEY_set1_DSA(key, d);
k->_key.key = key;
}
+#endif /* splint */
#endif /* HAVE_SSL */
void
}
#ifdef HAVE_SSL
+#ifndef S_SPLINT_S
EVP_PKEY *
ldns_key_evp_key(const ldns_key *k)
{
return NULL;
}
}
+#endif /* splint */
#endif /* HAVE_SSL */
unsigned char *
}
#ifdef HAVE_SSL
+#ifndef S_SPLINT_S
/* data pointer must be large enough (LDNS_MAX_KEYLEN) */
static bool
ldns_key_rsa2bin(unsigned char *data, RSA *k, uint16_t *size)
return true;
}
#endif /* USE_GOST */
+#endif /* splint */
#endif /* HAVE_SSL */
ldns_rr *
/* third - da algorithm */
switch(ldns_key_algorithm(k)) {
- case LDNS_RSAMD5:
- case LDNS_RSASHA1:
- case LDNS_RSASHA1_NSEC3:
- case LDNS_RSASHA256:
- case LDNS_RSASHA512:
+ case LDNS_SIGN_RSAMD5:
+ case LDNS_SIGN_RSASHA1:
+ case LDNS_SIGN_RSASHA1_NSEC3:
+ case LDNS_SIGN_RSASHA256:
+ case LDNS_SIGN_RSASHA512:
ldns_rr_push_rdf(pubkey,
ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k)));
#ifdef HAVE_SSL
}
#endif /* HAVE_SSL */
break;
- case LDNS_DSA_NSEC3:
+ case LDNS_SIGN_DSA_NSEC3:
ldns_rr_push_rdf(pubkey,
ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, LDNS_DSA_NSEC3));
#ifdef HAVE_SSL
ldns_rr_free(pubkey);
return NULL;
}
+#ifndef S_SPLINT_S
if (!ldns_key_gost2bin(bin, k->_key.key, &size)) {
LDNS_FREE(bin);
ldns_rr_free(pubkey);
return NULL;
}
+#endif /* splint */
internal_data = 1;
#endif /* HAVE_SSL and USE_GOST */
break;
ldns_rr_push_rdf(pubkey, ldns_native2rdf_int8(
LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k)));
bin = NULL;
+#ifndef S_SPLINT_S
ec = EVP_PKEY_get1_EC_KEY(k->_key.key);
+#endif
EC_KEY_set_conv_form(ec, POINT_CONVERSION_UNCOMPRESSED);
- size = i2o_ECPublicKey(ec, NULL);
+ size = (uint16_t)i2o_ECPublicKey(ec, NULL);
if(!i2o_ECPublicKey(ec, &bin)) {
EC_KEY_free(ec);
ldns_rr_free(pubkey);
{
fd_set fds;
int ret;
+#ifndef S_SPLINT_S
FD_ZERO(&fds);
FD_SET(FD_SET_T sockfd, &fds);
+#endif
if(write)
ret = select(sockfd+1, NULL, &fds, NULL, &timeout);
else
cur_node = ldns_rbtree_first(tree);
while (count < elements && cur_node != LDNS_RBTREE_NULL) {
move_node = ldns_rbtree_delete(tree, cur_node->key);
- ldns_rbtree_insert(new_tree, move_node);
+ (void)ldns_rbtree_insert(new_tree, move_node);
cur_node = ldns_rbtree_first(tree);
count++;
}
if (!key) {
return 0;
}
- return ldns_rr_dnskey_key_size_raw(ldns_rdf_data(ldns_rr_dnskey_key(key)),
+ return ldns_rr_dnskey_key_size_raw((unsigned char*)ldns_rdf_data(ldns_rr_dnskey_key(key)),
ldns_rdf_size(ldns_rr_dnskey_key(key)),
ldns_rdf2native_int8(ldns_rr_dnskey_algorithm(key))
);
unsigned int i;
unsigned int j;
- j = (uint32_t)((context->count >> 3) & 63);
+ j = (unsigned)(uint32_t)((context->count >> 3) & 63);
context->count += (len << 3);
if ((j + len) > 63) {
memmove(&context->buffer[j], data, (i = 64 - j));
}
ldns_sha1_update(context, finalcount, 8); /* Should cause a SHA1Transform() */
- if (digest)
+ if (digest != NULL)
for (i = 0; i < LDNS_SHA1_DIGEST_LENGTH; i++) {
digest[i] = (unsigned char)((context->state[i >> 2] >>
((3 - (i & 3)) * 8)) & 255);
typedef uint8_t sha2_byte; /* Exactly 1 byte */
typedef uint32_t sha2_word32; /* Exactly 4 bytes */
+#ifdef S_SPLINT_S
+typedef unsigned long long sha2_word64; /* lint 8 bytes */
+#else
typedef uint64_t sha2_word64; /* Exactly 8 bytes */
+#endif
/*** SHA-256/384/512 Various Length Definitions ***********************/
/* NOTE: Most of these are in sha2.h */
tmp = (tmp >> 16) | (tmp << 16); \
(x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
}
+#ifndef S_SPLINT_S
#define REVERSE64(w,x) { \
sha2_word64 tmp = (w); \
tmp = (tmp >> 32) | (tmp << 32); \
(x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
((tmp & 0x0000ffff0000ffffULL) << 16); \
}
+#else /* splint */
+#define REVERSE64(w,x) /* splint */
+#endif /* splint */
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
/*
(w)[1]++; \
} \
}
+#ifdef S_SPLINT_S
+#undef ADDINC128
+#define ADDINC128(w,n) /* splint */
+#endif
/*
* Macros for copying blocks of memory and for zeroing out ranges
#endif /* SHA2_UNROLL_TRANSFORM */
void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t len) {
- unsigned int freespace, usedspace;
+ size_t freespace, usedspace;
if (len == 0) {
/* Calling with no data is valid - we do nothing */
void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
sha2_word32 *d = (sha2_word32*)digest;
- unsigned int usedspace;
+ size_t usedspace;
/* Sanity check: */
assert(context != (ldns_sha256_CTX*)0);
#endif /* SHA2_UNROLL_TRANSFORM */
void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t len) {
- unsigned int freespace, usedspace;
+ size_t freespace, usedspace;
if (len == 0) {
/* Calling with no data is valid - we do nothing */
}
static void ldns_sha512_Last(ldns_sha512_CTX* context) {
- unsigned int usedspace;
+ size_t usedspace;
usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
return LDNS_STATUS_NULL;
}
- salt_length_str = strlen(salt_str);
+ salt_length_str = (int)strlen(salt_str);
if (salt_length_str == 1 && salt_str[0] == '-') {
salt_length_str = 0;
} else if (salt_length_str % 2 != 0) {
while(ldns_bget_token(str_buf, token, "\t\n ", strlen(str)) > 0) {
switch (token_count) {
case 0:
- precedence = atoi(token);
+ precedence = (uint8_t)atoi(token);
break;
case 1:
- gateway_type = atoi(token);
+ gateway_type = (uint8_t)atoi(token);
break;
case 2:
- algorithm = atoi(token);
+ algorithm = (uint8_t)atoi(token);
break;
case 3:
gateway = strdup(token);
/* now copy all into one ipseckey rdf */
if (gateway_type)
- ipseckey_len = 3 + ldns_rdf_size(gateway_rdf) + ldns_rdf_size(publickey_rdf);
+ ipseckey_len = 3 + (int)ldns_rdf_size(gateway_rdf) + (int)ldns_rdf_size(publickey_rdf);
else
- ipseckey_len = 3 + ldns_rdf_size(publickey_rdf);
+ ipseckey_len = 3 + (int)ldns_rdf_size(publickey_rdf);
data = LDNS_XMALLOC(uint8_t, ipseckey_len);
if(!data) {