Chipcard Woes

One of my customers, a large dental practice, had a problem from time to time when reading Krankenversicherungskarten (German health insurance card, KVK). The insurance number got all garbled up, which led to problems when reading the patient’s insurance data into the health care application. After their sysadmin and I analysed the situation it seemed that the application reading the data from the card and writing it to a file in a custom format was to blame. This program (KVKTool) was included with the Cherry card reader and had been modified by another consultant to write the read data to a file rather than displaying it on the screen.

This C++ program was a huge stinking pile. All card reading was done in a method called CKVKToolDlg::Onreadcard. The name CKVKToolDlg hints at it: This is the class responsible for showing the dialog. (Yes, it had been left in the program by the previous consultant. Only the dlg.DoModal() call had been commented out.) The method was a gigantic 837 lines long and features all kinds of goodies such as lots of copied-and-pasted code that had been modified in some instance to fix bugs, but not in others.

After a long refactoring session (which turned into a rewrite), I was able to spot the problem: a wrong workaround to bugs in a sizable amount of KVKs. Normally, the data on KVKs is structured into fields in an arbitrary order. These fields consist of a one-byte tag to identify the field, a one-byte length marker, and then n bytes of data, where nis the length. All KVK fields are identified by tags between 0x80 and 0x92. But all KVK fields are wrapped by a super-field called the “Versichten-Template” (insurant template, VT) with tag 0x60. Thus, data on a typical (non-buggy) KVK card would start like this:

0x60 0x89 0x85 0x09 0x53 0x65 0x62 0x61 …
VT tag VT len First name tag First name length Seba …

Now, buggy cards seem to insert a stray 0x81 byte after the 0x60 tag:

0x60 0x81 0x89 0x85 0x09 0x53 0x65 0x62 0x61 …
VT tag ??? VT len First name tag First name length Seba …

This code in the KVKTool was supposed to handle this problem:

    // skip tag 60 and length
    int i=2;

    // some cards seem to have a damaged tag 0x89 after 0x81
    if (responsearray[1] == 0x81)
        i++;

(Snipped the huge indention.)

responsearray is a buffer that contains the KVK data and i is an index into that buffer. This code works fine in most circumstances. It works around cards with the stray byte. But there is one situation where it utterly fails: On correct cards where the Versichten-Template is exactly 129 bytes long. In this case, the first tag is skipped entirely, which usually is the insurant’s number. Since it was not, junk (random memory content) was written to the file in place of the insurant’s number. Not good, but hopefully fixed now.

VirtualBox on i386 with amd64 Kernel

I have recently started to use an amd64 kernel on my i386 Debian unstable system. Unfortunately, VirtualBox OSE does not work with that setup. When I try to start a virtual machine, it fails with an oblique error message:

RTR3Init failed with rc=-1912 (rc=-1912)

The VirtualBox kernel modules do not fit to this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing

‘/etc/init.d/vboxdrv setup’

should fix that problem. Make sure that you don’t mix the OSE version and the PUEL version of VirtualBox.

Debian bug #456391 explains the problem. In that report Michael Meskes alludes to running VirtualBox in an amd64 chroot jail, so I tried this myself. It works flawlessly, once I got it setup. Here is what I did (as root):

robinson:~# mkdir /srv/amd64
robinson:~# cdebootstrap --arch amd64 sid /srv/amd64 http://ftp.debian.org/debian/
[...]
robinson:~# chroot /srv/amd64
robinson:/# apt-get update
[...]
robinson:/# apt-get upgrade
[...]
robinson:/# apt-get install virtualbox-ose # add more packages here if needed
[...]
robinson:/# adduser --uid 1000 --no-create-home --disabled-password --disabled-login srittau
[...]
robinson:/# 

These commands install the base system and create a user account. Now I created a script called /usr/local/bin/amd64.sh:

#!/bin/sh

CHROOT=/srv/amd64

if test ! -e $CHROOT/dev/.udev; then
    mount -t none /dev $CHROOT/dev/ -o bind
fi
if test `ls $CHROOT/proc | wc -l` = "0"; then
    mount -t proc none $CHROOT/proc
fi
if test `ls $CHROOT/sys | wc -l` = "0"; then
    mount -t sysfs none $CHROOT/sys
fi
if test `ls $CHROOT/home | wc -l` = "0"; then
    mount --bind /home $CHROOT/home
fi
chroot $CHROOT sh -c "su - srittau"

Running sudo amd64.sh will now enter the chroot environment as user srittau where I can start virtualbox normally.

Helmar Fanselau dies aged 56

I just learned that one of my former teacher, Helmar Fanselau, died on January 13th, aged 56. He was a strange man. Many students liked him because of his antics and strange sense for humor. Others did not like him for his harsh and unforgiving marks in his subjects, Latin and History. I think he was always fair, though, even if that worked to my disadvantage, because he actually liked me, but I got bad marks nevertheless. I still fondly remember him balancing rulers on his nose and for his ability to speak several different German dialects. His “weather show” featured them all in a stand-up comedy-like routine.

He always was a controversial person, though. I just found an article I wrote back in ’96 or ’97 about a school mess held by him during which the school parson actually put out the candles in protest.

There were always various rumours about Mr. Fanselau floating around in the school. For example, he was well known for eating from student’s lunch boxes. So, the story goes, a student prepared a special sandwich with tooth paste and put it on the teacher’s desk. Mr. Fanselau entered, saw the sandwich and ate it. When I questioned him about the story, Mr. Fanselau confirmed it, but was quick to add: “Well, I didn’t eat the whole sandwich.”

Finally, the way I found out about Mr. Fanselau’s death is as bizarre as was his personality: A rogue edit on Wikipedia. Goodbye, Helmar!

Upper Deck Entertainment vs. Konami

This is my take on the conflict between Konami and Upper Deck Entertainment (UDE) that is currently upsetting the Yu-Gi-Oh! Trading Card Game community. While I don’t play Yu-Gi-Oh! myself, as a Magic: The Gathering judge I have a certain interest in what happens in the industry overall. Oh, and I like soap operas. All information presented is scrounged from various sources around the net, including press releases by the companies, statements from employees, and court documents (or copies thereof provided in forums). Mixed in is my own opinion and assumptions, so don’t take anything in this article for granted.

This is what I think happened so far:

Konami is the producer of the Yu-Gi-Oh! Trading Card Game and owner of the rights to it. Upper Deck Entertainment is the distributor of the game in Europe and the US. UDE also handled Organized Play (OP) for the game in these territories. The distribution contract ended at the end of 2007, but there was a mutual agreement (either verbal or in the form of a Letter of Intent) between both companies that the contract was to be renewed for 2008 through 2010. There was no formal contract, though, so the companies just kept on going. (And I thought those were serious businesses …)

UDE was unhappy with the way Konami handled the game and how they were supported by Konami. So they took more and more liberties with how they ran the game. This reached a climax when in the summer of 2008 UDE manufactured copies (or “counterfeits” as Konami calls them) of special Yu-Gi-Oh! promotional cards and provided them to Vintage Sports Cards, who packaged them with three boosters and sold those packs in Toys-R-Us stores. Konami found out about the counterfeits and sued Vintage Sports Cards. When they found out that UDE had provided the cards, they allegedly asked UDE for clarification. When were giving insufficient information and threatened Konami with a breach of contract suit, Konami amended their suit at the end of 2008 to include UDE as a defendant. But before they could do so, UDE counter-sued on December, 12th 2008.

This led to the well-known exchange of press releases. (December, 11th 2008, Konami: “We’re taking over the distribution of Yu-Gi-Oh!“; December, 16th 2008, UDE: “Not true!“; December, 17th 2008, Konami: Yes, true!) At December 22th UDE wins an injunction against Konami in Europe that voids the cancellation of the contract. And a few days later the same happens in the US.

So, this year both companies are flexing their muscles and the background of the story became known. The main lawsuits are still pending, so it will stay interesting. In the long term it’s obvious that UDE will lose any distribution rights to the Yu-Gi-Oh! TCG, so all their bets are now on various World of Warcraft products. I am not sure what that means for Upperdeck’s OP department. I know that I will keep a watchful eye on further developments.

Coincidences

I turned 30 yesterday. I’m still not sure whether that’s a reason to celebrate or a reason to mourn. Anyway, there were two coincidences. Late on Sunday evening I was watching the remake of Shaft and started to wikipedia (doesn’t have the same sound as “google”, right?) for among other things Blaxploitation. Funnily, later that evening I watched Live and Let Die, the blaxploitation Bond movie.

Still reading Wikipedia I started to read about Tarantino movies and came across the article of Zoë Bell, the stunt double of Uma Thurman in Kill Bill and playing herself in Death Proof. It seems she has birthday on the exact same day as I. So, happy birthday to you, Zoë!

PTQ Berlin in Berlin I (FUNtainment)

Last Saturday (August 2nd) was the first of two locale PTQs for the Pro Tour in this very city. It was held at the FUNtainment Game Store. Going into the event I expected 70 X players. 70 is about the normal number for Block Constructed PTQs (which are never very strong), and X was going to be an unknown number to account for the fact that this was going to be for a local Pro Tour. It turned out that X was -12. A turnout of 58 players was very disappointing, but this was in line with the turnout at other PTQs. Dortmund also had 58 players and PTQs in the US and UK also reported a low turnout. We had the normal amount of players from outside Berlin (mainly from Hamburg, Magdeburg, and Poland), so this means that the Berlin players were underrepresented. We can only speculate about the reasons for the low turnout: Maybe it was because of the format or the fact that we have summer holidays in Germany. Maybe it’s also a combination of multiple facts.

The judge staff consisted of Kersten, who was going to be scorekeeping trainee, Christopher, Wolfram (my current trainee judge), and myself as head judge. The low turnout allowed me to coach both Kersten and Wolfram a bit, although things got a little bit hectic when we started a side event Grand Prix Trial (for Grand Prix Copenhagen) after the 4th round. This had exactly eight players, so it went straight to top 8.

During round 1 I’m checking deck lists, when I notice a Russian Reflecting Pool among the pile of lists. As I go hunting for the deck that this card belongs to, I come across a player (let’s call him Adrian) who uses the same sleeves. When I ask him whether it’s his card, he denies it and tells me that he counted 60 cards in his deck when he shuffled. I confirmed this by counting his cards again. He then asks his friend Bertram whether he was lent this card and Bertram claims that it was indeed one of the cards lent to Adrian. But since Adrian has a legal deck, I let them play on and went back to the judges station. When I count Adrian’s deck list, I notice that he marked down 61 cards on the list! Just as I am about to go back to the table, Adrian comes up to me and tells me that he remembers that he actually plays 61 cards. Well, I give the Game Loss for Deck/Decklist Mismatch. Since Adrian has just lost game 1, this means he lost the match. Had he remembered earlier, the Game Loss would have been applied to the game in progress …

During one of the later rounds we have scorekeeping problems. When Kersten went to fetch food there was some confusion that resulted in players being dropped from the tournament that wanted to play on and other drop being missed. I had the chance to show Kersten how to manually repair situations like this. Since it affected players in the upper third of the standings, I couldn’t just award byes to fix the situation. Also, players were already seated, so repairing the whole tournament would cause too much trouble. In the end I had to manually pair three tables and the tournament went on.

A player that was in contention for top 8 was deck checked. I noticed that his sleeves were in a really bad state. Most sleeves were just dirty, wrinkled, and generally unacceptable. But I noticed a total of four sleeves in a better condition. Two of those cards were Profane Commands, the others were lands. After taken a short look at the sleeves, I was able to identify both Profane Commands without more than glancing at the cards. I issued a penalty for Marked Cards – Pattern, although this was a borderline case that could also be ruled as Marked Cards – No Pattern. Of course the player had to resleeve. What I don’t get: The player had new sleeves with him. Why didn’t he use them in the first place? I know that the player had played a few PTQs before.

Be careful how you counter!

During swiss rounds Charles tries to counter Daniel’s Demigod of Revenge. Since he doesn’t announce that he waits for Demigod’s trigger to resolve before he counters, I rule that Demigod returns to play. This is the standard ruling for this situation. Daniel made it to top 8 and there a similar situation arises. He plays Demigod and his opponent, Evan, puts a Cryptic Command into play, without announcing modes or tapping mana, yet. Daniel claims/asks “[Demigod] trigger on the stack”. This time the ruling is not that clear, since Evan didn’t finish playing the Cryptic Command. Nevertheless I ruled the same way as before, since it was clear to me that Evan wanted to counter the Demigod and did not announce that he wanted to wait until the Demigod trigger resolves. Evan argued that both he and Daniel were experienced players, and knew how to correctly counter a Demigod. While I believe that that is true, I require some kind of visual or verbal clue that the player intends to wait for the trigger to resolve. Just knowing how to play it correctly is not enough. I made Evan announce the Cryptic Command correctly and have the Demigod return to play. I educated both players about clear communication, saying what you intend to do, and letting the opponent finish playing his spells before interrupting.

The tournament ran quite slowly. Especially during extra turns we should have watched the time more closely. Slow Play penalties are difficult to give. But one judge reminded players three times during a match to play more quickly, and didn’t hand out a penalty. This is clearly wrong. One reminder should be enough. But there were more delays: We waited for a few late players at the start of the tournament. Unfortunately a few trains arrive at a time that makes it impossible to arrive on time at the tournament site. So waiting for late players is common. I wonder whether we should just move the start time of tournaments where we expect players from outside Berlin and Brandenburg a quarter of an hour back. Then there were the scorekeeping issues. And finally seating the players alphabetically at the start of the tournament costs time. (But allows judges to be more efficient by collecting deck lists in a sorted manner. It also allows the head judge to make announcements without players being disturbed by shuffling or talking to their opponents.)

There were a few interesting rules questions:

  • I have taken control of a creature via Sower of Temptation and Sower becomes another creature, thanks to Mirrorweave. Do I keep the creature? You keep the creature. Sower’s ability just cares that you keep control of the object that used to be Sower. What happens if the former Sower dies? Your opponent gets his creature back. Same reasoning.
  • I control a Figure of Destiny that is currently a 4/4 Kithkin Spirit Warrior. Now my opponent play Mirrorweave, targeting an Eager Cadet. What happens to my Figure of Destiny? It’s now a 4/4 white Eager Cadet with creature types Kithkin Spirit Warrior and without abilities. Mirrorweave’s copy effect applies in layer 1 and changes the Figure of Destiny to an Eager Cadet. The enhance effect of Figure of Destiny applies in layer 4 (type changing effects) and 6b (other power/thoughness changing effects) and overrides the value set by the Mirrorweave.
  • I attack with an animated Mutavault. My opponent player Pollen Lullaby with Kicker and wins the clash. Does Mutavault untap during my next untap step? It does. Pollen Lullaby changes the rules of the game and doesn’t remember the objects that attacked.

This Sunday there is another PTQ at the Der Andere Spieleladen. I’m really looking forward to it, although I’m worried that the turnout will be low again.

PTQs for Valencia

It was a hard weekend. I was head-judging two Pro Tour Qualifiers for Valencia. The first on Saturday in the Der Andere Spieleladen here in Berlin, the second on Sunday in the Heldenwelt in Magdeburg.

Saturday we had 66 players. I had two floor judges (Robert Zemke and Christopher Eucken, both level 1) as well as two staff employees helping out. This turned out to be just the right number of staff for this event. The event went rather smooth, without any major headaches. The most problematic situation arised during top 8 when one player started with extensive trash talking and disregarding judge’s instructions to stop. Only after I made it very clear to him that I would issue the appropriate Unsporting Conduct penalty if he continued (a Match Loss at Competitive REL), did he stop.

Like at most PTQs here in Berlin we had a few Polish players. In general this is not a problem, since they speak English very well and I do all announcements in German and English. But it is always a problem if they with each other in Polish while another player is still playing. When players or spectators speak in English or German I am able to automatically filter out “harmless” chatter, e.g. a spectator telling a player that they will fetch food for themselves now or two spectators speaking about their last match. This is not possible when people speak a language I don’t understand. Therefore I ask them to stop communication more often than I ask players I can understand. This is not an ideal situation, but one that is hard to resolve, unfortunately.

In one semi-final match two of the Polish players were paired against each other. Both had card-identical decks, so the match was played in a rather light mood. The finals again were rather quiet. The event ended at about 23:30.

Unfortunately I did not get much sleep that night, so I was rather tired when I met my co-judge Kersten Rückert (L1) at Berlin Central Station at seven in the morning. Magdeburg’s judge situation is even worse than Berlin’s (it seems they don’t have any active judges), so they had to import judges from outside. This meant Kersten and me. One other judge unfortunately had cancelled his participation. At Magdeburg main station we were greeted by Peter from the Heldenwelt, who supported us as scorekeeper. With a total of 57 players (a good turnout, considering the location, and time during holidays) we were unstaffed by about one judge.

The tournament took place in a basement that consisted of two long halls with fairly high, vaulted ceilings. This gave the event a nice, medieval touch. One hall contained the playing tables, while the other had the scorekeeper and judge’s tables and the feature match area. The halls were connected at the end by two small doorways. Actually the layout was rather good, because the separate scorekeeper and judge tables meant quiet, relatively disturbance-free working. And you could use this hall to get quickly from one end of the playing area to the other one.

Teardrop was doing coverage of the event (in German). I like coverage for these smaller events. I think many people who can’t make it to the tournament can still follow it and see how their friends are doing. It helps the community in a local context the same way coverage of Pro Tours and Grand Prixs help the community at large.

Unfortunately the coverage was ill-fated. During round 5 one player of the match that was originally going to be covered was disqualified. (The other player of that match followed a bit later.) The next (and last) round of the tournament, the feature match was between two players who would make top 8 if they won the match. A spectator noticed marked sleeves though. When I checked the sleeves, I pulled out two cards that had especially bad, but different, marks, without looking at them. It turned out I had singled out two of the three Psionic Blasts in the deck. After a short glance at the sleeve of the third Blast I was able to consistently identify all three Blasts. After a short investigation I came to the conclusion that the player did not know about the marks and they occured because of wear during play. Nevertheless I had to issue a Game Loss for Marked Cards — Pattern. This is always a hard penalty to give in a situation like this (it effectively decided who got to top 8), but there was no way around it.

In the top 8 (which were played back in the store) Kersten had to give another Game Loss for Drawing Extra Cards, but apart from that the matches rent quiet and well. I was especially grateful that the final match between Jim Herold and Frieder Michel Drenger went rather quickly, since I and Kersten had to fetch the last train back to Berlin. We ended the day like we had started it: Sitting in the train, eating tasty and healthy food from McDonalds. Congratulations to Jim, who had already made top 8 the day before in Berlin and now has Pro Player level 3 status if he attends Pro Tour Valencia.

Blog Statistics

Yesterday I had a look at the webalizer statistics for this web page. Still, by far the most hits got my review of GTA: San Andreas, followed by several pages that are automatically fetched. It is also by far the entry page #1, with nearly five times as many hits as the root page. The referers to the GTA review are also interesting: Lots of people get there from Google’s image search, and some warez forums also seem to link there. (I wonder why, unfortunately these forums are all non-public.)

Also notable is page #2: /blog/submitcomment.cgi got more than 2000 hits this month alone. This is the script used to submit comments to blog entries. It shows how much comment SPAM I get per month, although only about one or two SPAM comments are not filtered out automatically. It seems that my list of filtered words is rather comprehensive.