MCPcopy Create free account
hub / github.com/F-Stack/f-stack / padlock_cipher_key_setup

Function padlock_cipher_key_setup

freebsd/crypto/via/padlock_cipher.c:100–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100static void
101padlock_cipher_key_setup(struct padlock_session *ses, const void *key, int klen)
102{
103 union padlock_cw *cw;
104 int i;
105
106 cw = &ses->ses_cw;
107 if (cw->cw_key_generation == PADLOCK_KEY_GENERATION_SW) {
108 /* Build expanded keys for both directions */
109 rijndaelKeySetupEnc(ses->ses_ekey, key, klen * 8);
110 rijndaelKeySetupDec(ses->ses_dkey, key, klen * 8);
111 for (i = 0; i < 4 * (RIJNDAEL_MAXNR + 1); i++) {
112 ses->ses_ekey[i] = ntohl(ses->ses_ekey[i]);
113 ses->ses_dkey[i] = ntohl(ses->ses_dkey[i]);
114 }
115 } else {
116 bcopy(key, ses->ses_ekey, klen);
117 bcopy(key, ses->ses_dkey, klen);
118 }
119}
120
121int
122padlock_cipher_setup(struct padlock_session *ses,

Callers 2

padlock_cipher_setupFunction · 0.85
padlock_cipher_processFunction · 0.85

Calls 2

rijndaelKeySetupEncFunction · 0.85
rijndaelKeySetupDecFunction · 0.85

Tested by

no test coverage detected