Codebase list libcryptx-perl / 2a49c90
XS cosmetics related to ed25519/x25519 Karel Miko 4 years ago
2 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
2828 PPCODE:
2929 {
3030 int rv;
31 /* gen the key */
31 self->initialized = 0;
3232 rv = ed25519_make_key(&self->pstate, self->pindex, &self->key);
3333 if (rv != CRYPT_OK) croak("FATAL: ed25519_make_key failed: %s", error_to_string(rv));
3434 self->initialized = 1;
9797 if (SvOK(key)) {
9898 key_data = (unsigned char *)SvPVbyte(key, key_len);
9999 }
100 self->initialized = 0;
100101 if (which == 0) {
101102 rv = ed25519_import_raw(key_data, (unsigned long)key_len, PK_PUBLIC, &self->key);
102103 }
138139 not_used = hv_store(rv_hash, "priv", 4, newSVpv(buf, blen), 0);
139140 }
140141 else {
141 not_used = hv_store(rv_hash, "priv", 4, &PL_sv_undef, 0);
142 not_used = hv_store(rv_hash, "priv", 4, newSVpvn(NULL, 0), 0); /* undef */
142143 }
143144 /* pub */
144145 blen = sizeof(buf);
2828 PPCODE:
2929 {
3030 int rv;
31 /* gen the key */
31 self->initialized = 0;
3232 rv = x25519_make_key(&self->pstate, self->pindex, &self->key);
3333 if (rv != CRYPT_OK) croak("FATAL: x25519_make_key failed: %s", error_to_string(rv));
3434 self->initialized = 1;
9797 if (SvOK(key)) {
9898 key_data = (unsigned char *)SvPVbyte(key, key_len);
9999 }
100 self->initialized = 0;
100101 if (which == 0) {
101102 rv = x25519_import_raw(key_data, (unsigned long)key_len, PK_PUBLIC, &self->key);
102103 }
138139 not_used = hv_store(rv_hash, "priv", 4, newSVpv(buf, blen), 0);
139140 }
140141 else {
141 not_used = hv_store(rv_hash, "priv", 4, &PL_sv_undef, 0);
142 not_used = hv_store(rv_hash, "priv", 4, newSVpvn(NULL, 0), 0); /* undef */
142143 }
143144 /* pub */
144145 blen = sizeof(buf);