authsetup contains all the funtionality needed to generate, load and save
private and public keys, and to lock and unlock the private key with a
password.
Private and public keys are used to authenticate the player to servers,
and are loaded from config/authprivate.cfg. Private keys can be stored
in an "encrypted with password" version - in which case the player has
to enter the password after game start. To prevent brute-force cracking
of the password, the key-derivation function uses a constant time to
encode (usually several seconds). Because of that, the decoding at game
start can be done in the background.
The private key is actually itself a public key generated from the
prepriv key. The prepriv key should be kept away from the computer, either
as hardcopy or on a thumbdrive. The prepriv key is not required to play
the game. It can be used to prove ownership of the private key, in case
the private key gets stolen. It can also be used to regenerate private
and public keys, in case they are lost. The prepriv key can also be
encrypted by its own password.
authsetup
checks private and public key and returns "1", if they match.
authsetup pre preprivhex [psalthex pwdcfg]
loads prepriv key into memory. optionally supports encrypted keys.
authsetup priv privhex [salthex pwdcfg]
loads private key into memory. optionally supports encrypted keys.
authsetup pub pubhex
loads public key into memory.
authsetup ppass preprivpass
decrypts prepriv key with password
authsetup pass privpass
decrypts private key with password
authsetup passd privpass [commandwhendone]
decrypts private key with password in background. optionally executes
cubescript command when done.
authsetup needpass
returns "1" if the private key needs decryption.
authsetup genpre [prelen]
generates new prepriv key.
authsetup genpriv
generates private key from prepriv key.
authsetup genpub
generates public key from private key.
authsetup newppass preprivpass [preprivfilename]
encrypts prepriv key with new password and saves the result to file.
The default filename is config/authpreprivate.cfg and an existing file
gets overwritten - but the former file content is kept and also written,
each line commented out.
authsetup newpass privpass [privatefilename]
encrypts private key with new password and saves the encrypted private
key and the public key to file. The default filename is
config/authprivate.cfg and an existing file gets overwritten - but the
former file content is kept and also written, each line commented out.
authsetup unarmed
sets private and public keys to a fixed value. For testing only.
Can be used to "log out".
authmemusage, authrounds, authmaxtime are only used, when new passwords are
created (authsetup new[p]pass). authmemusage is the number of megabytes
of RAM that are used for the password hash calculation. If authrounds
is zero (as is default), then the hash algorithm calculates as many
rounds as possible in the number of milliseconds specified in
authmaxtime. If authrounds is a positive number, then that is the number
of rounds to be done, regardless the required time. Note that, since the
password hash algorithm is not endianness-aware, it is not possible to
move an encrypted password to a machine with different endianness.
Moving between 32- and 64-bit machines should be no problem.
FIXME: the command is not blocked against use in multiplayer. It has to
be determined later, if this is a problem or feature. Especially
the background password calculation may be a problem.
DOCREF authsetup cryptodebug authmemusage authrounds authmaxtime
* FNV-1a: very fast, non-cryptographic hash
* bin2hex, hex2bin: hex ascii parser and hex string formatter
* ed25519test: vector test for all ed25519 functions
* ed25519speedtest: yep, that
The Ed25519 sources were taken from the crypto_sign/ed25519/ref
subdirectory of the SUPERCOP benchmarking tool.
The Ed25519 software is in the public domain.
Contributors (in alphabetical order)
Daniel J. Bernstein, University of Illinois at Chicago
Niels Duif, Technische Universiteit Eindhoven
Tanja Lange, Technische Universiteit Eindhoven
Peter Schwabe, National Taiwan University
Bo-Yin Yang, Academia Sinica
* basically a hash function that delivers keylen bytes calculated
from password and salt
* uses a lot of memory and a quite complex algorithm, to make
brute-force offline-attacks on short passwords as hard as possible
* last line of defense against "evil little brothers"
SHA512 was adapted from a few public domain sources and pseudocode from
wikipedia. The entropy collector gathers entropy from keyboard events and
mouse movement - and, just for fun, from screenshots.
The entropy pool is saved at program exit and reloaded at program start.
Entropy is used to re-seed the pseudorandom generator (not that it would
make a difference).
Calculate some key values to determine map geometry viability.
mapareacheck <what>
Returns different sets of statistics, depending on the keyword "what":
vdelta
Returns table of numbers of cubes within a certain range of vdelta
differences (steepness)". First entry is "0..2 cubes steep", next is
"2..4" and so on.
steepest
Returns the coordinates of the steepest heightfield cube.
total
Returns the number of non-solid cubes on the map.
pprest
Returns the number of cubes _not_ visible from one of the probe
positions.
pp (default)
Returns a table of all (currently 64) probe points of the map. Each
probe point is listed with:
- x-coordinate
- y-coordinate
- floor height
- area visible
- volume of visible area
- average height in visible area
DOCREF mapareacheck
* sort colored lights behind white ones to avoid a light bug
* sort all clipped entities to the end of the list to speed up physics
* sort all pickups and playerstarts to use smaller index numbers to
use less bandwidth
...and some options for sortmapmodelslots and sorttextureslots
All three commands now accept three modifier keywords as arguments:
nosort do not sort the list alphabetically
nomerge do not merge any slots
mergeused merge used and unused (identical) slots freely
By default, the list is sorted and only unused identical slots are merged.
The keywords can be combined in any order. "nomerge" takes priority over
"mergeused".
Examples:
sortmapmodelslots
Sort the mapmodel slot list alphabetically and merge unused identical
slots. Merging an unused slot is pretty much the same as deleting it,
so this command sorts the list and removes unneeded double entries.
sortmapmodelslots nosort
Merges (deletes) unused double entries in the mapmodel slot list.
sorttextureslots nosort mergeused
Merges double entries in the texture slot list. If two identical
entries are used in the map, all uses are mapped to the new combined
slot. This leaves no visual changes on the map. Should be avoided, if
texture slots have been renamed manually - and the the renaming isn't
finished yet.
sortmapsoundslots mergeused
Sorts the mapsound slot list and merges all double entries.
DOCREF sortmapmodelslots sorttextureslots sortmapsoundslots
backpedal 1/42 of a microstep to get out of the way of rounding errors
(clip ents are not supposed to have seams, but at least GCC builds
with -O3 seem to also require a little here - so, 1/333 for clips)
instead of using a constant (and always wrong) speed, use the same part
of the movement vector that x- and y- slides use
(sadly, this fix seems to raise problems with the previous "fix sliding
along corners" commit, which seems to have liked the constant speed...)
* properly rotate the player hitbox
* add "corner bounce" (doesn't work flawlessly - but it's probably as
good as possible with this kind of physics engine)
(for now) by default bound to the '#'-key (and backslash)
Press and hold the '#'-key and scroll the wheel to scroll console.
Just pressing and releasing '#' resets the console position.
Without the console open, releasing '#' always resets the console position.
also add script to generate a summary map license file
new (undocumented) debug commands:
loadmap <mapname>
loads a map directly, easy to use from scripts
debugline <filename> <text>
writes text to file (no path names allowed)
Two new string variables, mapinfo_license and mapinfo_comment, are stored
withing the header of a map file.
The variables are automatically read and written during loading and
saving maps. Default values are empty strings. The comment string is
ignored, as long as no license string is set. The license string is meant
to hold an abbreviated name of the license, picked from a list of
known map licenses.
DOCREF mapinfo_license mapinfo_comment
* strip unused mapmodel, texture and sound slots from config files
* clip stair mapmodels with sloped clip entities
* remove double clipping
dev_douze has been replaced by a version from the AC 1.0 era, including
flag bases - but with no team spawns. Corners now utilise higher mips
where possible.
dev_stellar has not been optimised.
* renamed (temporarily) to dev_*
* embedded all config files
* changed as many clip entities to tagged clips as possible
On ac_toxic and ac_venison all other clip entities also have been
optimised. Some bugs and unnecessary quirks on venison have been removed.
* toxic now uses 135 clipped entities (instead of 221)
* venison now uses 115 clipped entities (instead of 393)
new physics for tagclipped corner cubes:
* corners between non-solids: tagclips extend the corner
(visualisation does not reflect that, yet)
* corners between solids: fully clipped (like before)
Drop support for maps outside packages/maps and for package config files.
(never been used in AC anyway)
also: generate all map related filenames with proper path separators
* do not use std::abs() because math.h includes one, that converts ints
to double. Use own iabs(), which directly uses labs() instead.
* don't use the word "gamma" as name for variables
* don't use a homebrew round() function
getclosestent
Returns the entity index number of the closest entity (or of the
pinned entity, if one exists). Returns -1, if no entities are on the map.
Returns always exactly the entity, that edit commands like delent
will use next.
DOCREF getclosestent
addentity <type>
Adds an entity of the specified type at the current camera position
and returns the index number of the new entity, so that the other
attributes can be set by editentity.
DOCREF addentity
* fix the old check for different jump start heights as requirement
for doublejumps
* better handle multiple binds for the "jump" command
* delay relaxed floorclamping for crouching
* remove some redundant code
Instead of applying 25% bonus speed with every executed doublejump (with
potentially unlimited top speed), limit the reachable max speed to 125%
of regular full speed.
This limits regular gameplay only marginally but removes a lot of cheat
potential.
When both "forward" and "backward" keys are pressed, now the action
matches the last pressed one. Now the keys work on the ladder exactly
as with regular movement.
VS2008 doesn't have round() in math.h and the old inline function (removed
in 50d1413d, had problems in newer compilers). Now floor() or straight
casting to int is used. Let's see, which MS compiler will trip on that...
This is coded into the priority of a server:
* a priority of -1000 or lower marks a server as disabled
* a priority of -10000 or lower excludes a server from being saved to
pcksources.cfg at program end, so a game restart will delete the server
from the list
According to SDL documentation, the SDL implementation of timedwait may
suck on some platforms, so it should only be used, where high CPU usage
during the wait is no issue.
getpckserver() will now only wait for one second for access to the
package server list and return an error instead of waiting indefinitely.
Don't have the main thread wait for the ping thread, because the ping
thread may take a long time to respond - when a server connection can't
be established. Sadly, there's no timeout for "connect()".
Just placing the flag on top of the water didn't work for fully flooded
map areas, as the flag went out of reach.
This fix tries to float the flag up to the surface and stops, if something
blocks the way.
although I doubt, that anyone ever fell for that
(the fix prevents, that nickname completion can change the first char of
the console string to a slash, which would change the line from chat to
command)
Mapmodels which were not found once are put on a list and not tried to
be loaded again. With this commit, the list is cleared during a map load
if autodownload is enabled. This causes all missing models to be
downloaded.
Fixes issues with manually aborted autodownloads.
http get now uses two timeout values: one for the max time since last
server response, and one for total download time.
When AC is waiting for a server response (before a http header was
received), the progress bar will show the timeout "completion".