On Wed, Oct 07, 2015 at 07:16:58PM +0200, Holger Freyther wrote:
+static int
oap_evaluate_challenge(const struct oap_state *state,
+ const uint8_t *rx_random,
+ const uint8_t *rx_autn,
+ uint8_t *tx_xres)
+{
+ OSMO_ASSERT(sizeof(auth.u.umts.k) == sizeof(state->secret_k));
+ OSMO_ASSERT(sizeof(auth.u.umts.opc) == sizeof(state->secret_opc));
static assert?
erm, that's a bit dumb indeed. I do feel more warm and fuzzy with it
around somewhere. Can I put it in oap_init()?
+ memcpy(auth.u.umts.k, state->secret_k, sizeof(auth.u.umts.k));
+ memcpy(auth.u.umts.opc, state->secret_opc, sizeof(auth.u.umts.opc));
+ memset(auth.u.umts.amf, 0, 2);
sizeof?
I picked it up from some other code around. Kindly elaborate on the
question..?
+ auth.u.umts.sqn = 42; /* TODO */
In three years we wonder what the todo is. I think it is a good habbit to add
a short summary what we want to do.
I think it's pretty much right in every crypto face. The sequence nr is
constant! let me out! ;) but ok
BTW we talked about whether OAP is finished, but indeed this part is
missing.
+struct msgb
*oap_encoded(const struct oap_message *oap_msg)
encode? Sure it is encoded after the function is done but it triggers the
encoding?
It takes care of allocation in The OAP Way (tm) (makes a msgb with given
numbers) and conveniently does the obvious steps of encoding an oap_msg
struct. It encodes. trigger?
+{
+int oap_register(struct oap_state *state, struct msgb **msg_tx)
return the struct msgb*? If it is NULL you already know it didnt't work
and the -1/0 carry as much value right now?
At the time of writing I kept the option of returning distinct error
codes. This just needs a bool apparently, that's correct. But in fact I
would like to keep the msg_tx analogy to oap_handle().
+ case
OAP_MSGT_REGISTER_RESULT:
+ // successfully registered!
no C99 comments (sorry to have away the method again)
I don't understand "have away the method". But will fix the comment.
~Neels